code for Ivor Horton's Beginning Java, Java7 Edition