A more realistic class
public class Person {
// instance variables
int age;
String name;
// A constructor
public Person (Sting n, int a) {
this.name = n;
this.age = a;
}
}
Note:
we have a constructor
we have data local to any instance of Person
Previous slide
Next slide
Back to first slide
View graphic version