// This program will show off a couple introductory facets of using objects public class PersonClient { public static void main(String[] args) { // Java will implement a default constructor that will set // fields to their "null-equivalent" value. For the String name, // it will be null, and for age it will be 0 Person p = new Person(); System.out.println(p.name); System.out.println(p.age); // We could change our fields like so p.name = "Paul"; p.age = 51; // We can create multiple instances of a class. // Each of these objects and their fields are independant // of each other. Person t = new Person(); t.name = "Tyler"; t.age = 22; // Here we see that changing "t"'s fields didn't change "p"'s System.out.println(p.name); System.out.println(p.age); System.out.println(t.name); System.out.println(t.age); // We can call a method on specific object and again, that will // use and change that specific objects fields, independant of // the other t.celebrateBirthday(); System.out.println(p.name); System.out.println(p.age); System.out.println(t.name); System.out.println(t.age); } }