You are previewing Sams Teach Yourself Java in 21 Days, Sixth Edition.

Sams Teach Yourself Java in 21 Days, Sixth Edition

Cover of Sams Teach Yourself Java in 21 Days, Sixth Edition by Rogers Cadenhead Published by Sams
O'Reilly logo

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 ...

The best content for your career. Discover unlimited learning on demand for around $1/day.