And here is a Java application that tests some aspects of the class Person:
0534: import java.io.BufferedReader; // UsePerson.java 0535: import java.io.InputStreamReader; 0536: import java.io.IOException; 0537: public class UsePerson { 0538: public static void main(String[ ] args) throws IOException { 0539: BufferedReader input = 0540: new BufferedReader(new InputStreamReader(System.in)); 0541: Person tGirlfriend = 0542: new Person("Smith", 5.5F, new Date(1973, 2, 27)); 0543: System.out.print("Girlfriend> "); System.out.println(tGirlfriend); 0544: Person tWife = new Person(); 0545: System.out.print("Wife> "); System.out.println(tWife); 0546: Person tBaby; 0547: tWife = tGirlfriend; 0548: System.out.print("Wife> "); System.out.println(tWife); 0549: tBaby = new Person(input.readLine()); 0550: System.out.print("Baby> "); System.out.println(tBaby); 0551: System.out.println(tWife.getName().equals(tBaby.getName())); 0552: } 0553: }When this program is executed, it produces output like:
Girlfriend> Smith%5.5%1973-02-27 Wife> %0.0%0-00-00 Wife> Smith%5.5%1973-02-27 Smith%1.5%1990-4-9 Baby> Smith%1.5%1990-04-09 true