O'Reilly logo

Sams Teach Yourself Java in 21 Days, Sixth Edition by Rogers Cadenhead

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Quiz Answers

Chapter 1

1. B. A class is an abstract template used to create objects that are similar to each other.

2. B. You define how the subclass is different from its superclass. The things that are similar are already defined for you because of inheritance. Answer A is technically correct, but if everything in the subclass is identical to the superclass, there’s no reason to create the subclass.

3. C. Instance methods refer to a specific object’s behavior. Class methods refer to the behavior of all objects belonging to that class.

Chapter 2

1. B. In Java, a boolean can be only true or false. If you put quotation marks around the value, it is treated like a String rather than one of the two boolean values.

2. C. Constant names are capitalized ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required