public class Person { private String name; private Date birthday; private Date died; public Person( String name, Date bday, Date dday ) { this.name = name; this.birthday = bday; this.died = dday; } public String getName( ) { return name; } public void setName( String name) { this.name = name; } public String toString( ) { return name + birthday.toString() + died.toString(); } public static void main( String[] args ) { Person bob = new Person( "Bob", new Date(1,2, 1950), new Date(1,10,2006)); System.out.println( bob ); System.out.println("Bob's name is " + bob.getName()); System.out.println("Changing Bob's name to Robert"); bob.setName( "Robert"); System.out.println("Bob's name is now : + bob.getName()); } }