Introduction
Part I The Programmer's Exam
Chapter 1 Language Fundamentals
Source Files
Keywords and Identifiers
Primitive Data bees
Literals
boolean Literals
char Literals
IntegraI Literals
Floating--Point Literals
String Literals
Arrays
Class Fundamentals
The mairt() Method
Variables and Initialization
Argument Passing
Garbage Collection
Chapter Summary
Test Yourself
Chapter 2 Operators and Assignments
Evaluation Order
The Unary Operators
The Increment and Decrement Operators: ++ and --
The Unary Plus and Minus Operators: + and -
The Bitwise Inversiori Operator: ~
The Boolean Complement Operator: !
The Cast Operator: (type)
The Arithmetic Operators
The Multiplication and Division Operators: * and /
The Modulo Operator: %
The Addition and Subtraction Operators: + and --
Arithmetic Error Conditions,
The Shift Operators: >, and >>>
Fundamentals of Shifting
Shifting Negative Numbers,
Reduction of the Right Operand
Arithmetic Promotion of Operands
The Comparison Operators
Ordinal Comparisons with , and >=
The thetanceof Operator
The Equality Comparison Operators: == and !=
The Bitwise Operators: &, ^, and l
Boolean Operations
The Short-Circuit Logical Operators
The Conditional Operator: ?:
The Assignment Operators
An Assgument Has Value
Chapter Summary
The Unary Operators
The Arithmetic Operators
The Shift Operators
The Bitwise Operators
The Assignment Operators
Test Yourself
Chapter 3 Modmers
Modifier Ovefview
The Access Modifiers
public
Prtvate
Default
protected
Subclasses and Method Privacy
Summary of Access Modes
Other Modifiers
final
abstract
static
Static Initializers
native
transient
synchronised
volatile
Modifiers and Features
Chapter Summary
Test Yourself
Chapter 4 Converting aud Casting
ExPlicit and Implicit toe Changes
Primltives and Conversion
Primitive Conversion: Assignment
Assignment Conversion, Little Primitives, and Literal Values
Primitive Conversion: Method Call
Primitive Conversion: Arithmetic Promotion
Primitives and Casting
Object Reference Conversion
Object Reference Assignment Conversion
Object Method--Call Conversion
Object Reference Casting
Chapter Summary
Test Yourself
Chapter 5 Flow Coutrol and Exceptious
The Loop Constructs
The while() Loop
The do Loop
The for() Loop
The break and conttnue Statements in Loops
The Selection Statements
The if()/else Construct
The switch() Construct
Exceptions
Flow of Control in Exception Conditions
Throwing Exceptions
Chapter Summary
Loop Constructs
Selection Statements
Flow in Exception Handling
Exception Throwing
Test Yourself
Chapter 6 Objects and Classes
Benefits of Object--Oriented Implementation
Abstract Data Types
Reuse
Implementing Object--Oriented Relationships
Overioading and Overriding
Overloading Method Names
Method Overriding
Constructors and Subclassing
Overloading Constructors
Inner Classes
The Enclosing this Reference and Construction of Inrier Classes
Member Classes
Classes Defined Inside Methods
Chapter Summary
Object-Oriented Design and Implementation
Overloading and Overriding
Constructors and Subclassing
lnner Classes
Test Yourself
Cbapter 7 Threads
Thread Fundamentals
What a Thread Executes
When Executlon Ends
Thread States
Thread Priorities
Controlling Threads
Yielding
Suspending
Sleeping
Blocking
Monitor States
Scheduling Implementations
Monitors, wait(), and notify()
The Object Lock and Synchronization
wait() and natify()
The Class Lock
Beyond the Pure Model
Deadlock
Strange Ways to Srochronize
Chapter Summary
Test Yourself
Chapter 8 The jasa.lang and java.util Packnges
The Object Class
The Math Class
The Wrapper Classes
Strings
The String Class
The StrtingBuffer Class
String Concatenation the Easy Way
The Collections API
Collection Types
Collection Implementations in the API
Collections and Code Maintenance
Summary of Collections
Chapter Summary
Test Yourself
Chapter 9 Layout Managers
Why Java Uses Layout Managers
How Layout Managers Solve the Problem
Layout Manager Theory
Contalners and Components
Component Size and Position
Layout Policies
The Flow Layout Manager
The Grid Layout Manager
The Border Layout Manager
The Card Layout Manager
The GridBag Layout Manager
Controlling the Cell Size fOr a Component
GridBag's Shorthand
Other Layout Options
Improving Your Chances
Chapter Summary
Test Yourself
Chapter 1O Events
Mothation for the Event Delegation Model
The Event Class Hierarchy
Semantic Events
Event Listeners
ExPlicit Event Enabling
Adapters
Action Commands
Chapter Summary
Test Yourself
Cbapter 11 Components
Components in General
getSise()
setForegrourtd() and setBackground()
setFont()
seocnabled()
setSize() and setBounds()
setVisible()
The Visual Components
Button
Canvas
Checkbox
Choice
FileDialog
tobel
List
ScrouPane
Scrollbar
TextFiesd and TextArea
The Container Components
Applet
Frame
Panel
Dialog
The Menu Components
Chapter Summary
Test Yourself
Chapter 12 Painting
The Paint() Method and the Graphics Context
Selecting a Color
Selecting a Font
Drawing and Filling
Clipping
Painting a Contained Component
The GUI Thread and the rePaint() Method
Spontaneous Painting
The repatnt() Method
Images
Double Buffering Using Images
Chapter Summary
Test Yourself
Chapter 13 Iuput and Output
File Input and Output
Text Representation and UTF
The File Class
The RandowtccessFile Class
Streams, Readers, and Writers
Low-Level Streams
High-Level Filter Streams
Readers and Writers
Encodings
Object Streams and Serialization
Sockets
Chapter Summary
Test Yourself
part II The Developer's Exam
Chapter 14 Taking the Developer's Exam
Are You Ready for the Exam?
Formalities of the Exam
Downloading the Assignment
Taking the Follow-up Exam
What the Assignment Covers
How the Assignment and Exam Are Graded
JDK l.2 Specifics
Cbapter 15 Assignmeut: Room Reservation System
Structure of the Assignment
Business Scenario
Project Specifics
Code and APIs Provided
Functional Goals
Write a User Interface
Enable Network Access (Client--Server)
Add Features to an Existing Database
Other Requirements
Adhere to Supplied Naming
Stress Readability
Usejavadoc-Style Comments
Chapter 16 Enhancing and Extending tbe Database
Two--Tier Databases
Designing a Basic Scheme
Using Interfaces
Using Abstract Classes
Issues in Implementation
Exception Handling
Desmp Impediments
Thread Safety
Supporting New Features
Chapter Summary
Chapter 17 wntiug the Network Protocol
Client--Server from Scratch
Server Operation
Connecting Clients to the Server
Communications Protocol
The Client/Request Structure
Limitations of the Model
Remote Method Invocation (RMI)
A Model RMI Transaction
Implementing RMI
Limitations of RMI
More on Threads
Sharing Threads
ChaPter Summary
Cbapter 18 Designing the User 1nterface
Defining the GUI's Requirements
Identifying Needed Components
Sketching the GUI
Isolating Regions of Behavior
Choosing Layout Managers
Using Swing
Tables
Lists
Using Layout Managers
CardLayout
GridBagLayout
Event Handling and Style
Event Handling and Threads
Chapter Summary
Chapter 19 A Second Example: A Trouble-Ticket System
More on Exam Requirements
Assmpment: Build a Trouble-Ticket System
GUI Development
Database/Server Development
Client--Server Logic
Delivering the Finished Assignment
Chapter 2O GUI Prototyping
Events and Properties
Building a JTable
Using AbstractTableModel ,
Building a JTree
Mnas, JButtons, and Actioris
Panes
JSplitPane
JOptionPane
Final Thoughts on Code Style '
Cbapter 21 Bullding the Database Server
Database Requirements
Implementing RMI
Exporting with UnicastRemoteObject
EXporting an Acttvatable Object
Record Locking
Chapter Summary
Cbapter 22 Connecting Client and Server
Notification Basics
Using JavaBean Conventions
Event Adapters
Remote Notification
Using Distributed Notification
Chapter Summary
Chapter 23 Preparlng the Upload
Submission Requirements
Usingjavadoc
File Structure
writing the README file
Using the jar Tool
Chapter Summary
Cbapter 24 Thinking About the Follow-Up Exam
Preparation Questions
What are the choices for data structures?
Is implementing Runnable better than extending Thread?
Isn't comparlng obect serialization to RMI an apples-to-oranges analysis?
How elaborate should an exception class structure get?
How many ways can you set up "listener" relationships?
Which one is best?
How do I know which layout manager to use?
Which design patterns are most useful in this
kind of project? "
When does it make sense to use protected and default scope?
Doesn't an abstract class let the developer specify more
behavior than an interface?
Chapter Summary "
Part III Appendices
Appendix A Answers to Test Yourself Questions
Appendix B Programmer's Finai Exam
Appeudix C Using the Test Program
The Real Test
The Supporting Instructions
The Tester
Running the Tester
Imposing a Time Limit
Answering the guestions
Appendix D The Certification Iuitiative for Enterprise Development
The Structure of the Initiative
The Second--Level Exams
The Common Exam at Level II
The Vendor-Specific Exams at Level II
Other Vendor Exams at Level II
The Third--Level Exams
The Common Exam at Level IIl
The Vendor-Specific Exams at Level lII
Other Vendor Exams at Level III