Skip to main content

Section 7.1 Starter Level

Exercises Exercises

The code below defines a Person class, with a first and last name and age as the properties.
Data: persondatafile
public class Person {
	public String firstName;
	public String lastName;
	public int age;

	public Person(String f, String l, int a) {
		firstName = f;
		lastName = l;
		age = a;
	}
	@Override
	public String toString() {
	  return firstName;
	}
	// public static void main(String args[]) {} 
}
Add code below to create another person, with a name and age of your choosing.
Add code below to create another person, with a name and age of your choosing.
You have attempted of activities on this page.