Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: newbie help

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default newbie help

    Hey guys,

    I'm a java newbie struggling to correct this problem. It's an error mesage I get, don't understand why.

    It's a homework assignment and I have to create Person, Date, SSN objects and run them in main together.

    The error occurs when, in main, I try to create a new Person and plug in first name, last name, etc.

    public class PersonTester {
     
    	public static void main(String[] args) {
     
     
    	Date hermanBday = new Date(11,11,2011);
    	Person Ken = new Person();
    	Person Herman = new Person("Herman", 'H', "Wilson", hermanBday, "111-11-1111");
     
     
    	} //end main
    }//end class

    I get this error message when I compile:

    ----jGRASP exec: javac -g PersonTester.java

    PersonTester.java:8: cannot find symbol
    symbol : constructor Person(java.lang.String,java.lang.String,java.lang .String,Date,java.lang.String)
    location: class Person
    Person Herman = new Person("Herman", 'H', "Wilson", sueBday, "111-11-1111");
    ^
    1 error

    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.



    Here's the Person class, the error message hints that something is wrong w my constructor (my default constructor seems to work fine)

      public class Person {
     
          private String firstName;
          private char middleInitial;
          private String lastName;
          private Date birthdate;
          private SSN social;
     
     
       //no-arg constructor
          public Person() {
     
             firstName = null;
             middleInitial = '\0';
             lastName = null;
             birthdate = null;
             social = null;
          }
     
       //constructor method
          public Person(String fn, char mi, String ln, Date bDate, SSN soc) {
     
             firstName = fn;
             middleInitial = mi;
             lastName = ln;
             birthdate = bDate;
    	 social = soc;
          }
     
    	//toString Method
          public String toString() {
     
             String str = (	"\nFirst Name: " + firstName +
                			"\nMiddle Initial: " + middleInitial +
                			"\nLast Name: " + lastName +
    				"\nBirthdate: " + birthdate +
                			"\nSocial Security Number: " + social);
             return(str);
          }
    Last edited by willmeister; October 1st, 2011 at 05:13 PM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: newbie help

    cannot find symbol
    symbol : constructor Person(java.lang.String, java.lang.String, java.lang.String, Date, java.lang.String)
    location: class Person
    Person Herman = new Person("Herman", 'H', "Wilson", sueBday, "111-11-1111");
    Does the Person class have a constructor that matches the one that you are calling in line 8?

    Where is sueBday? I don't see it in the code you posted.

Similar Threads

  1. Newbie here
    By zoneraider in forum Member Introductions
    Replies: 2
    Last Post: September 8th, 2010, 05:18 AM
  2. Me = Newbie;
    By Bacon n' Logic in forum Member Introductions
    Replies: 6
    Last Post: August 31st, 2010, 08:28 PM
  3. Help to a newbie!
    By painthygrave in forum AWT / Java Swing
    Replies: 0
    Last Post: April 7th, 2010, 10:29 PM
  4. another newbie..
    By xdigg in forum Member Introductions
    Replies: 0
    Last Post: February 15th, 2010, 07:51 AM
  5. I'm a newbie
    By r12ki in forum Member Introductions
    Replies: 2
    Last Post: June 1st, 2009, 06:38 AM