Java chapter 2 example