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.

System.out.println("Name is: " + name + " Age is: " + age + "Nationality is:" + nationality); );

I've try your codes it runs error free

oh totally missed that ); thanks for the heads up. I know you said you were getting no errors but now I'm getting missing method body...

// ------------------------------------------------------------
// 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;
}

Error:

Person.java:26: missing method body, or declare abstract
    Person(String newName, int newAge, String newNationality);
    ^
Person.java:28: cannot find symbol
symbol  : variable newName
location: class Person

No semicolons after method names in the definition.

// ------------------------------------------------------------
// 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;
}

Look at line 4.
Just a few small errors. It looks like you know what your doing for the most part. Good work.
By the way, to use code tags use code=java, not java=code. Thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.