// // Supporting material for lecture 14 // // private static variables // // Person class, each person created increases the population :) // public class Demo14a { public static void main(String[] args){ Person x = new Person("Patrick","Prosser",21); System.out.println(x.getPop()); Person y = new Person("Andrea","Turnbull",18); System.out.println(x.getPop()); Person z = new Person("Zoe","Prosser"); System.out.println(x.getPop() + " " + y.getPop() + " " + z.getPop()); x.marry(y); System.out.println(x); System.out.println(y); System.out.println(z); String s = z.getName(); if (z.isMarried()) s = s + " is married"; else s = s + " is not married"; System.out.println(s); } } // // NOTES // - how things are constructed // - note two different constructors // - how we call methods, such as getName and marry // - automatic use of toString in System.out.println! // //