Java practise exam question Doing practise questions for a Java exam which have no answers (useful) I have been asked to do the following:

Write a class called Person with the following features:


a private int called age;
a private String called name;
a constructor with a String argument, which initialises name to the received value and age to 0;
a public method toString(boolean full). If full is true, then the
method returns a string consisting of the person’s name followed by their
age in brackets; if full is false, the method returns a string consisting of
just the name. For example, a returned string could be Sue (21) or Sue;
a public method incrementAge(), which increments age and returns the
new age;
a public method canVote() which returns true if age is 18 or more and
false otherwise.


My code is as follows can someone point out any errors?

public class Person
{
    private int age;
    private String name;

    public Person(String st)
    {
      name = st;
      age = 0;
    }

   public String toString(boolean full)
   {
     if(full == true)
     {
        return name + "(" + age + ")";
     }
     else
     {
        return name;
     }
   }

   public int incrementAge()
   {
      age++;
      return age;
   }

   public boolean canVote()
   {
     if(age &gt;= 18)
     {
        return true;
     }
     else
     {
        return false;
     }
   }
}
instead of 

if(full == true)


use

if (full)


and instead of 

if(age &gt;= 18)
{
   return true;
}
else
{
   return false;
}


use:

return age &gt;= 18