so the constuctor is saying ) expected, error not a statement and ; expected
Person num1, num2, num3;
num1=new Person(Allison, 6600 Crescent Ave, 32, 902
Step 1:
First you can check your Person
class object is created.
Print some message in
public Person() {
System.out.println("in default constructor");
}
if you can not see any print statement then problem with object.
Step 2:
Check what you pass and passed value is print or not
.
If not print then problem with your parameter(argument)
.
Your Problem:
You are not passing actual string value
,You have to pass string value wihin ""
num1=new Person("Allison", "6600 Crescent Ave", 32, 9024231421);
Many SO user give actually answer but this stuff is for feature reader so user can see and don't take mistake next time.
num1=new Person(Allison, 6600 Crescent Ave, 32, 9024231421);
should be
num1=new Person("Allison", "6600 Crescent Ave", 32, 9024231421);
String, String, int and long are expected in this order by your constructor, which is defined by public Person(String nm, String adr, int ag, long phn)
.
Allison without (double)quotes is not a String.
You are not passing a string for Name and Address to your constructor, try changing
num1=new Person(Allison, 6600 Crescent Ave, 32, 9024231421);
to
num1=new Person("Allison", "6600 Crescent Ave", 32, 9024231421);
Because strings are always used within the double quotes . put your arguments which are strings in the double quotes.
you are calling construtor that in not exist for your first argument you have defined string so pass in double quote while calling construtor