Java chapter 2 and chapter 3 examples