Constructor
Edit the following code by adding two constructors. The
first takes two arguments which are meant to initialize the
name and age variables. The second constructor
only takes one argument that is the name and initializes
the age to 0.
class Person {
String name;
int age;
//YOUR CONSTRUCTORS HERE!!!
void printPerson() {
System.out.print("Hi, my name is " + name);
System.out.println(". I am " + age + " years old.");
}
public static void main (String arguments[]) {
Person p;
p = new Person("Luke", 50);
p.printPerson();
System.out.println("----");
p = new Person("Laura", 35);
p.printPerson();
System.out.println("----");
}
}