Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

creating class

843789Dec 8 2009 — edited Dec 8 2009
Hey im creating a class as im trying to learn java Ive been following my book word for word on creating classes heres my code which i have finished but it still wont compile
/**Person class*/
public class Person
{ 
	private String firstname;
	private String lastname;
	Private double age;
	Private double height;
	//sets name
	
	public void setFirstname(String name)
	{
		firstname = name;
	}
	public void setLastname(String name2)
	{
		lastname = name2;
	}
	public void setAge(double old)
	{
		age = old;
	}
	public void setHeight(double tall)
	{
		height = tall;
	}
	
	public String getFirstname()
	{
		return firstname;
	}
	public String getLastname()
	{
		return lastname;
	}
	public double getAge()
	{
		return age;
	}
		public double getHeight()
	{
		return height;
	}
}
Person.java:6: <identifier> expected
Private double age;
^
Person.java:6: <identifier> expected
Private double age;
^
Person.java:7: <identifier> expected
Private double height;
^
Person.java:7: <identifier> expected
Private double height;
^
4 errors

that is the error it is returning but im not sure what i should change in my code to fix it

Edited by: James-----m on Dec 8, 2009 8:31 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 5 2010
Added on Dec 8 2009
26 comments
239 views