just trying to create a person(or two) using name, age and nationality but its giving me illegal start of expression error
// ****************************************************************
// Person.java
//
// Person class with two constructors
// ***************************************************************
public class Person
{
private String name;
private int age;
private String nationality;
// ------------------------------------------------------------
// Default constructor
// ------------------------------------------------------------
Person()
{
name = null;
age =0;
nationality = null;
}
// ------------------------------------------------------------
// Another constructor - with two parameters - if you know the name and the age of a Person
// ------------------------------------------------------------
Person(String newName, int newAge, String newNationality);
{
name = newName;
age = newAge;
nationality = newNationality;
}
// ------------------------------------------------------------
// Another constructor - with one parameter - if you know only the name of a Person
// ------------------------------------------------------------
Person(String newName)
{
name = newName;
age = 0;
nationality = null;
}
// ------------------------------------------------------------
// Accessor methods
// ------------------------------------------------------------
public String getName(){
return name;
}
public int getAge(){
return age;
}
public String getNationality(){
return nationality;
}
// ------------------------------------------------------------
// Mutator methods
// ------------------------------------------------------------
public void setName(String newName){
name = newName;
}
public void setAge(int newAge){
age = newAge;
}
public void setNationality(String newNationality) {
nationality = newNationality;
}
// ------------------------------------------------------------
// Other methods
// ------------------------------------------------------------
public void printPerson(){
System.out.println("Name is: " + name + " Age is: " + age + "Nationality is:" + nationality); );
}
// ---------------------------------------------------------
// Creates two person objects
// Displays the data fields of the objects
// ---------------------------------------------------------
public static void main (String[] args)
{
Person person1 = new Person();//create a Person object
person1.setName("Sally"); //set the name using a mutator method
person1.setAge(13);//set the age using a mutator method
person1.setNationality("hawaiian"); //set the nationality using a mutator method
Person person2 = new Person("Sam", 15, egyption);//create a second Person and use 2-parameter constructor
//Displaying using the get methods
System.out.println ("\nDisplaying the objects data fields using the accessor methods");
System.out.println ("name: " + person1.getName() + "\tage: " + person1.getAge() + "\nnationality" + person1.getNationality());
System.out.println ("name: " + person2.getName() + "\tage: " + person2.getAge() + "\nnationality" + person2.getNationality());
}
}
Error:
Person.java:80: illegal start of expression
System.out.println("Name is: " + name + " Age is: " + age + "Nationality is:" + nationality); );
^
1 error
----jGRASP wedge2: exit code for process is 1.