| |
| |
About the Contributors | |
| |
| |
Acknowledgments | |
| |
| |
Preface | |
| |
| |
Introduction | |
| |
| |
| |
Declarations and Access Control | |
| |
| |
Java Refresher | |
| |
| |
Identifiers & JavaBeans (Objectives 1.3 and 1.4) | |
| |
| |
Legal Identifiers | |
| |
| |
Sun's Java Code Conventions | |
| |
| |
JavaBeans Standards | |
| |
| |
Declare Classes (Exam Objective 1.1) | |
| |
| |
Source File Declaration Rules | |
| |
| |
Class Declarations and Modifiers | |
| |
| |
| |
Creating an Abstract Superclass and Concrete Subclass | |
| |
| |
Declare Interfaces (Exam Objectives 1.1 and 1.2) | |
| |
| |
Declaring an Interface | |
| |
| |
Declaring Interface Constants | |
| |
| |
Declare Class Members (Objectives 1.3 and 1.4) | |
| |
| |
Access Modifiers | |
| |
| |
Nonaccess Member Modifiers | |
| |
| |
Constructor Declarations | |
| |
| |
Variable Declarations | |
| |
| |
Declaring Enums | |
| |
| |
Two-Minute Drill | |
| |
| |
Q&A | |
| |
| |
Self Test | |
| |
| |
Self Test Answers | |
| |
| |
| |
Object Orientation | |
| |
| |
Encapsulation (Exam Objective 5.1) | |
| |
| |
Inheritance, Is-A, Has-A (Exam Objective 5.5) | |
| |
| |
IS-A | |
| |
| |
HAS-A | |
| |
| |
Polymorphism (Exam Objective 5.2) | |
| |
| |
Overriding / Overloading (Exam Objectives 1.5 and 5.4) | |
| |
| |
Overridden Methods | |
| |
| |
Overloaded Methods | |
| |
| |
Reference Variable Casting (Objective 5.2) | |
| |
| |
Implementing an Interface (Exam Objective 1.2) | |
| |
| |
Legal Return Types (Exam Objective 1.5) | |
| |
| |
Return Type Declarations | |
| |
| |
Returning a Value | |
| |
| |
Constructors and Instantiation (Exam Objectives 1.6 and 5.4) | |
| |
| |
Determine Whether a Default Constructor Will Be Created | |
| |
| |
Overloaded Constructors | |
| |
| |
Statics (Exam Objective 1.3) | |
| |
| |
Static Variables and Methods | |
| |
| |
Coupling and Cohesion (Exam Objective 5.1) | |
| |
| |
Two-Minute Drill | |
| |
| |
Q&A | |
| |
| |
Self Test | |
| |
| |
Self Test Answers | |
| |
| |
| |
Assignments | |
| |
| |
Stack and Heap-Quick Review | |
| |
| |
Literals, Assignments, and Variables (Exam Objectives 1.3 and 7.6) | |
| |
| |
Literal Values for All Primitive Types | |
| |
| |
Assignment Operators | |
| |
| |
| |
Casting Primitives | |
| |
| |
Using a Variable or Array Element That Is Uninitialized and Unassigned | |
| |
| |
Local (Stack, Automatic) Primitives and Objects | |
| |
| |
Passing Variables into Methods (Exam Objective 7.3) | |
| |
| |
Passing Object Reference Variables | |
| |
| |
Does Java Use Pass-By-Value Semantics? | |
| |
| |
Passing Primitive Variables | |
| |
| |
Array Declaration, Construction, and Initialization (Exam Objective 1.3) | |
| |
| |
Declaring an Array | |
| |
| |
Constructing an Array | |
| |
| |
Initializing an Array | |
| |
| |
Initialization Blocks | |
| |
| |
Using Wrapper Classes and Boxing (Exam Objective 3.1) | |
| |
| |
An Overview of the Wrapper Classes | |
| |
| |
Creating Wrapper Objects | |
| |
| |
Using Wrapper Conversion Utilities | |
| |
| |
Autoboxing | |
| |
| |
Overloading (Exam Objectives 1.5 and 5.4) | |
| |
| |
Garbage Collection (Exam Objective 7.4) | |
| |
| |
Overview of Memory Management and Garbage Collection | |
| |
| |
Overview of Java's Garbage Collector | |
| |
| |
Writing Code That Explicitly Makes Objects Eligible for Collection | |
| |
| |
| |
GC Analysis | |
| |
| |
Two-Minute Drill | |
| |
| |
Q&A | |
| |
| |
Self Test | |
| |
| |
Self Test Answers | |
| |
| |
| |
Operators | |
| |
| |
Java Operators (Exam Objective 7.6) | |
| |
| |
Assignment Operators | |
| |
| |
Relational Operators | |
| |
| |
instanceof Comparison | |
| |
| |
Arithmetic Operators | |
| |
| |
Conditional Operator | |
| |
| |
Logical Operators | |
| |
| |
Two-Minute Drill | |
| |
| |
Q&A | |
| |
| |
Self Test | |
| |
| |
Self Test Answers | |
| |
| |
| |
Flow Control, Exceptions, and Assertions | |
| |
| |
if and switch Statements (Exam Objective 2.1) | |
| |
| |
if-else Branching | |
| |
| |
switch Statements | |
| |
| |
| |
Creating a switch-case Statement | |
| |
| |
Loops and Iterators (Exam Objective 2.2) | |
| |
| |
Using while Loops | |
| |
| |
Using do Loops | |
| |
| |
Using for Loops | |
| |
| |
Using break and continue | |
| |
| |
Unlabeled Statements | |
| |
| |
Labeled Statements | |
| |
| |
| |
Creating a Labeled while Loop | |
| |
| |
Handling Exceptions (Exam Objectives 2.4 and 2.5) | |
| |
| |
Catching an Exception Using try and catch | |
| |
| |
Using finally | |
| |
| |
Propagating Uncaught Exceptions | |
| |
| |
| |
Propagating and Catching an Exception | |
| |
| |
Defining Exceptions | |
| |
| |
Exception Hierarchy | |
| |
| |
Handling an Entire Class Hierarchy of Exceptions | |
| |
| |
Exception Matching | |
| |
| |
Exception Declaration and the Public Interface | |
| |
| |
Rethrowing the Same Exception | |
| |
| |
| |
Creating an Exception | |
| |
| |
Common Exceptions and Errors (Exam Objective 2.6) | |
| |
| |
Working with the Assertion Mechanism (Exam Objective 2.3) | |
| |
| |
Assertions Overview | |
| |
| |
Enabling Assertions | |
| |
| |
Using Assertions Appropriately | |
| |
| |
Two-Minute Drill | |
| |
| |
Q&A | |
| |
| |
Self Test | |
| |
| |
Self Test Answers | |
| |
| |
| |
Strings, I/O, Formatting, and Parsing | |
| |
| |
String, StringBuilder, and StringBuffer (Exam Objective 3.1) | |
| |
| |
The String Class | |
| |
| |
Important Facts About Strings and Memory | |
| |
| |
Important Methods in the String Class | |
| |
| |
The StringBuffer and StringBuilder Classes | |
| |
| |
Important Methods in the StringBuffer and StringBuilder Classes | |
| |
| |
File Navigation and I/O (Exam Objective 3.2) | |
| |
| |
Serialization (Exam Objective 3.3) | |
| |
| |
Dates, Numbers, and Currency (Exam Objective 3.4) | |
| |
| |
Working with Dates, Numbers, and Currencies | |
| |
| |
Parsing, Tokenizing, and Formatting (Exam Objective 3.5) | |
| |
| |
A Search Tutorial | |
| |
| |
Locating Data via Pattern Matching | |
| |
| |
Tokenizing | |
| |
| |
Formatting with printf() and format() | |
| |
| |
Two-Minute Drill | |
| |
| |
Q&A | |
| |
| |
Self Test | |
| |
| |
Self Test Answers | |
| |
| |
| |
Generics and Collections | |
| |
| |
Overriding hashCode() and equals() (Objective 6.2) | |
| |
| |
Overriding equals() | |
| |
| |
Overriding hashCode() | |
| |
| |
Collections (Exam Objective 6.1) | |
| |
| |
So What Do You Do with a Collection? | |
| |
| |
Using the Collections Framework (Objective 6.5) | |
| |
| |
ArrayList Basics | |
| |
| |
Autoboxing with Collections | |
| |
| |
Sorting Collections and Arrays | |
| |
| |
Generic Types (Objectives 6.3 and 6.4) | |
| |
| |
Generics and Legacy Code | |
| |
| |
Mixing Generic and Non-generic Collections | |
| |
| |
Polymorphism and Generics | |
| |
| |
Generic Methods | |
| |
| |
Generic Declarations | |
| |
| |
Two-Minute Drill | |
| |
| |
Q&A | |
| |
| |
Self Test | |
| |
| |
Self Test Answers | |
| |
| |
| |
Inner Classes | |
| |
| |
Inner Classes | |
| |
| |
Coding a "Regular" Inner Class | |
| |
| |
Referencing the Inner or Outer Instance from Within the Inner Class | |
| |
| |
Method-Local Inner Classes | |
| |
| |
What a Method-Local Inner Object Can and Can't Do | |
| |
| |
Anonymous Inner Classes | |
| |
| |
Plain-Old Anonymous Inner Classes, Flavor One | |
| |
| |
Plain-Old Anonymous Inner Classes, Flavor Two | |
| |
| |
Argument-Defined Anonymous Inner Class | |
| |
| |
Static Nested Classes | |
| |
| |
Instantiating and Using Static Nested Classes | |
| |
| |
Two-Minute Drill | |
| |
| |
Q&A | |
| |
| |
Self Test | |
| |
| |
Self Test Answers | |
| |
| |
| |
Threads | |
| |
| |
Defining, Instantiating, and Starting Threads (Exam Objective 4.1) | |
| |
| |
Defining a Thread | |
| |
| |
Instantiating a Thread | |
| |
| |
Starting a Thread | |
| |
| |
Thread States and Transitions (Exam Objective 4.2) | |
| |
| |
Thread States | |
| |
| |
Preventing Thread Execution | |
| |
| |
Sleeping | |
| |
| |
| |
Creating a Thread and Putting It to Sleep | |
| |
| |
Thread Priorities and yield() | |
| |
| |
Synchronizing Code (Exam Objective 4.3) | |
| |
| |
Synchronization and Locks | |
| |
| |
| |
Synchronizing a Block of Code | |
| |
| |
Thread Deadlock | |
| |
| |
Thread Interaction (Exam Objective 4.4) | |
| |
| |
Using notifyAll() When Many Threads May Be Waiting | |
| |
| |
Two-Minute Drill | |
| |
| |
Q&A | |
| |
| |
Self Test | |
| |
| |
Self Test Answers | |
| |
| |
Exercise Answers | |
| |
| |
| |
Development | |
| |
| |
Using the javac and java Commands (Exam Objectives 7.1, 7.2, 7.5) | |
| |
| |
Compiling with javac | |
| |
| |
Launching Applications with java | |
| |
| |
Searching for Other Classes | |
| |
| |
JAR Files (Exam Objective 7.5) | |
| |
| |
JAR Files and Searching | |
| |
| |
Using Static Imports (Exam Objective 7.1) | |
| |
| |
Static Imports | |
| |
| |
Two-Minute Drill | |
| |
| |
Q&A | |
| |
| |
Self Test | |
| |
| |
Self Test Answers | |
| |
| |
| |
About the CD | |
| |
| |
System Requirements | |
| |
| |
Installing and Running Master Exam | |
| |
| |
Master Exam | |
| |
| |
Electronic Book | |
| |
| |
Help | |
| |
| |
Removing Installation(s) | |
| |
| |
Technical Support | |
| |
| |
LearnKey Technical Support | |
| |
| |
Index | |