I have the 7th/8th edition of Core Java. Why do most of the sample programs have compiler errors?
Make sure that the language level of your IDE is not set to Java SE 1.4.