A Programmer's Guide to Java Certification: A Comprehensive Primer / Edition 1

A Programmer's Guide to Java Certification: A Comprehensive Primer / Edition 1

by Khalid Azim Mughal, Rolf W. Rasmussen, Rolf Rasmussen
     
 

ISBN-10: 0201596148

ISBN-13: 9780201596144

Pub. Date: 08/19/1999

Publisher: Pearson Education

This book allows readers to master the Java programming language, teaching them what they need to know to pass the Sun Certified Java Programmer Examination. In their approach, the authors bring the sound pedagogical teaching practices from their university environment while bearing in mind the practical result-oriented realities of the IT industry. No previous Java

Overview

This book allows readers to master the Java programming language, teaching them what they need to know to pass the Sun Certified Java Programmer Examination. In their approach, the authors bring the sound pedagogical teaching practices from their university environment while bearing in mind the practical result-oriented realities of the IT industry. No previous Java experience and only some programming experience is required. Readers will also find that they can use this book as a self-study guide.

Product Details

ISBN-13:
9780201596144
Publisher:
Pearson Education
Publication date:
08/19/1999
Edition description:
Older Edition
Pages:
688
Product dimensions:
7.41(w) x 9.26(h) x 1.58(d)

Table of Contents

Preface vii
About this book
vii
Using the book
viii
Book web sites
ix
Conventions used in the book
ix
Request for feedback
x
Authors' background
x
Acknowledgments
xi
Basics of Java Programming
1(19)
Introduction
2(1)
Classes
2(2)
Declaring Members: Variables and Methods
3(1)
Objects
4(2)
Class Instantiation
4(1)
Object References
5(1)
Instance Members
6(1)
Invoking Methods
6(1)
Static Members
7(2)
Inheritance
9(2)
Aggregation
11(1)
Tenets of Java
11(3)
Review Questions
12(2)
Java Programs
14(1)
Sample Standalone Java Application
14(2)
Main Elements of a Java Standalone Application
14(1)
Compiling and Running a Standalone Program
15(1)
Sample Java Applet
16(4)
Main Elements of an Applet
16(1)
Compiling and Running an Applet
17(1)
Review Questions
18(1)
Chapter Summary
19(1)
Language Fundamentals
20(21)
Language Building Blocks
21(7)
Lexical Tokens
21(1)
Identifiers
21(1)
Keywords
21(1)
Literals
21(1)
Integer Literals
22(2)
Floating-point Literals
24(1)
Boolean Literals
24(1)
Character Literals
24(2)
String Literals
26(1)
White Spaces
26(1)
Comments
27(1)
Review Questions
28(1)
Primitive Datatypes
28(1)
Variable Declarations
29(2)
Declaring, Initializing and Using Variables
29(1)
Object Reference Variables
30(1)
Integers
31(1)
Characters
31(1)
Floating-point Numbers
31(1)
Booleans
32(1)
Wrapper Classes
32(2)
Review Questions
33(1)
Initial Values for Variables
34(3)
Default Values for Member Variables
34(1)
Initializing Local Variables of Primitive Datatypes
35(1)
Initializing Local Reference Variables
36(1)
Review Questions
36(1)
Java Source File Structure
37(1)
Review Questions
38(1)
The main () Method
38(3)
The main () Method Modifiers
39(1)
Review Questions
39(1)
Chapter Summary
39(1)
Programming Exercises
40(1)
Operators and Assignments
41(45)
Precedence and Associativity Rules for Operators
42(1)
Conversions
43(2)
Casting
43(1)
Narrowing and Widening Conversions
43(1)
Numeric Promotions
44(1)
Type Conversion Contexts
45(1)
Simple Assignment Operator =
45(4)
Assigning Primitive Values
46(1)
Assigning References
46(1)
Multiple Assignments
46(1)
Numeric Type Conversions on Assignment
47(1)
Review Questions
48(1)
Arithmetic Operators: *, /, %, +, -
49(5)
Arithmetic Operator Precedence and Associativity
49(1)
Arithmetic Expression Evaluation
50(1)
Numeric Promotions in Arithmetic Expressions
51(2)
Arithmetic Extended Assignment Operators: *=, /=, %=, +=, -=
53(1)
The Binary String Concatenation Operator +
54(1)
Variable Increment and Decrement Operators: ++, --
54(4)
Increment Operator ++
54(1)
Decrement Operator --
55(1)
Review Questions
55(3)
Boolean Expressions
58(1)
Relational Operators: <, <=, >, >=
58(1)
Equality
59(2)
Primitive Data Value Equality: ==, !=
59(1)
Object Reference Equality: ==, !=
59(1)
Object Value Equality
60(1)
Boolean Logical Operators: !, ^, &, |
61(2)
Operand Evaluation for Boolean Logical Operators
62(1)
Boolean Logical Extended Assignment Operators: &=, ^=, |=
62(1)
Conditional Operators; &&, ||
63(1)
Short-circuit Evaluation
64(1)
Representing Integers
64(2)
Calculating 2's Complement
65(1)
Integer Bitwise Operators: ~, &, |, ^
66(2)
Bitwise Extended Assignment Operators: &=, ^=, |=
67(1)
Shift Operators: <<, >>, >>>
68(3)
The Shift-left Operator <<
69(1)
The Shift-right-with-sign-fill Operator >>
70(1)
The Shift-right-with-zero-fill Operator >>>
70(1)
Shift Extended Assignment Operators: <<=, >>=, >>>=
71(1)
The Conditional Operator? :
71(1)
Other Operators: new, [], instanceof
72(2)
Review Questions
72(2)
Parameter Passing
74(2)
Passing Primitive Data Values
76(1)
Passing Object Reference Values
77(2)
Passing Array References
79(1)
Array Elements as Actual Parameters
80(2)
final Parameters
82(1)
Program Arguments
82(4)
Review Questions
83(1)
Chapter Summary
84(1)
Programming Exercises
85(1)
Declarations and Access Control
86(46)
Arrays
87(10)
Declaring Array Variables
87(1)
Constructing an Array
88(1)
Initializing an Array
89(1)
Using an Array
89(2)
Multidimensional Arrays
91(2)
Anonymous Arrays
93(1)
Review Questions
94(3)
Defining Classes
97(1)
Defining Methods
97(3)
Statements
98(1)
Instance Methods and Object Reference this
98(1)
Method Overloading
99(1)
Constructors
100(5)
Default Constructor
101(2)
Overloaded Constructors
103(1)
Review Questions
103(2)
Packages
105(3)
Defining Packages
106(1)
Using Packages
107(1)
Accessibility Modifiers for Classes and Interfaces
108(1)
Other Modifiers for Classes
109(3)
abstract Classes
109(1)
final Classes
110(1)
Review Questions
111(1)
Scope and Accessibility of Members
112(2)
Class Scope for Members
112(1)
Book Scope for Local Variables
113(1)
Member Accessibility Modifiers
114(7)
public Members
115(2)
protected Members
117(1)
Default Accessibility for Members
118(1)
private Members
118(2)
Review Questions
120(1)
Other Modifiers for Members
121(11)
static Members
121(2)
final Members
123(1)
abstract Methods
124(1)
synchronized Methods
124(1)
native Methods
125(1)
transient Variables
126(1)
volatile Variables
126(1)
Review Questions
127(3)
Chapter Summary
130(1)
Programming Exercises
131(1)
Flow Control and Exception Handling
132(40)
Overview of Flow Control Statements
133(1)
Selection Statements
133(8)
Simple if Statement
133(1)
if-else Statement
134(2)
switch Statement
136(4)
Review Questions
140(1)
Iteration Statements
141(4)
while Statement
142(1)
do-while Statement
143(1)
for Statement
143(2)
Transfer Statements
145(8)
break Statement
145(2)
continue Statement
147(1)
return Statement
148(1)
Review Questions
149(4)
Exception Handling
153(3)
Exception Types
155(1)
try, catch and finally Blocks
156(4)
try Block
157(1)
catch Block
157(2)
finally Block
159(1)
throw Statement
160(2)
throws Clause
162(10)
Review Questions
164(5)
Chapter Summary
169(1)
Programming Exercises
169(3)
Object-oriented Programming
172(51)
Inheritance
173(6)
Object-oriented Programming Concepts
175(3)
Review Questions
178(1)
Method Overriding and Variable Shadowing
179(8)
Method Overriding
179(2)
Variable Shadowing
181(1)
Overriding vs. Overloading
181(2)
Object Reference super
183(2)
Review Questions
185(2)
Chaining Constructors using this () and super ()
187(8)
this() Constructor Call
188(2)
super() Constructor Call
190(3)
Review Questions
193(2)
Interfaces
195(6)
Defining Interfaces
195(2)
Implementing Interfaces
197(1)
Extending Interfaces
197(1)
Supertypes
198(1)
Constants in Interfaces
199(1)
Review Questions
199(2)
Assigning, Passing and Casting References
201(12)
Reference Assignment Conversions
204(1)
Parameter Passing Conversions
205(1)
Reference Casting and instanceof Operator
206(3)
Converting References of Class and Interface Types
209(1)
Review Questions
210(3)
Polymorphism and Dynamic Method Lookup
213(4)
Review Questions
216(1)
Inheritance vs. Aggregation
217(6)
Encapsulation
217(1)
Choosing between Inheritance and Aggregation
217(3)
Review Questions
220(1)
Chapter Summary
221(1)
Programming Exercises
222(1)
Inner Classes
223(27)
Overview of Nested Classes
224(2)
Top-level Nested Classes and Interfaces
226(4)
Non-static Inner Classes
230(8)
Accessing Shadowed Members from Non-static Inner Classes
232(2)
Compiling and Importing Non-static Inner Classes
234(1)
Inheritance and Containment Hierarchy of Non-static Inner Classes
235(1)
Review Questions
236(2)
Local Classes
238(5)
Access Rules for Local Classes
240(1)
Instantiating Local Classes
240(3)
Anonymous Classes
243(7)
Extending an Existing Class
243(2)
Implementing an Interface
245(1)
Instantiating Anonymous Classes
245(1)
Access Rules for Anonymous Classes
246(1)
Review Questions
247(2)
Chapter Summary
249(1)
Programming Exercise
249(1)
Object Lifetime
250(21)
Garbage Collection
251(6)
Object Lifetime
251(1)
Cleaning Up
251(1)
Object Finalization
252(1)
Finalizer Chaining
253(2)
Invoking Garbage Collection
255(1)
Review Questions
255(2)
Initializers
257(14)
Variable Initializer Expressions
257(3)
Static Initializer Blocks
260(2)
Instance Initializer Blocks
262(2)
Constructing Initial Object State
264(3)
Review Questions
267(3)
Chapter Summary
270(1)
Threads
271(24)
Multitasking
272(1)
Threads
272(1)
Main Thread
273(1)
Thread Creation
273(6)
Implementing the Runnable Interface
273(3)
Extending the Thread Class
276(2)
Review Questions
278(1)
Synchronization
279(4)
Monitors
279(1)
Synchronized Methods
280(1)
Synchronized Blocks
281(1)
Review Questions
282(1)
Thread Transitions
283(12)
Thread States
283(1)
Thread Priorities
284(1)
Thread Scheduler
285(1)
Running and Yielding
285(1)
Sleeping and Waking Up
286(1)
Waiting and Notifying
286(4)
Miscellaneous Methods in the Thread Class
290(2)
Review Questions
292(1)
Chapter Summary
293(1)
Programming Exercises
294(1)
Fundamental Classes
295(28)
Overview of the java. lang package
296(1)
The Object Class
296(3)
Review Questions
298(1)
The Wrapper Classes
299(4)
Common Wrapper Class Constructors
299(1)
Common Wrapper Class Utility Methods
300(1)
Boolean Class
301(1)
Character Class
301(1)
Numeric Wrapper Classes
301(1)
Void Class
302(1)
Review Questions
302(1)
The Math Class
303(4)
Miscellaneous Rounding Functions
303(1)
Exponential Functions
304(1)
Trigonometry Functions
305(1)
Pseudo Random Number Generator
305(1)
Review Questions
305(2)
The String Class
307(10)
Creating and Initializing Strings
307(2)
Reading Individual Characters in a String
309(1)
Comparing Strings
310(1)
Character Case in a String
311(1)
Concatenation of Strings
311(1)
Searching for Characters and Substrings
312(1)
Extracting Substrings
313(1)
Conversion of Objects to Strings
313(1)
Review Questions
314(3)
The String Buffer Class
317(6)
Constructing String Buffers
317(1)
Changing and Reading Characters in String Buffers
318(1)
Constructing Strings from String Buffers
318(1)
Appending, Inserting and Deleting Characters in String Buffers
318(2)
Controlling String Buffer Capacity
320(1)
Review Questions
320(1)
Chapter Summary
321(1)
Programming Exercises
322(1)
Collections
323(28)
Collections Framework
324(3)
Core interfaces
324(1)
Implementations
325(1)
Algorithms
326(1)
Collections
327(3)
Review Questions
329(1)
Sets
330(3)
Lists
333(5)
Review Questions
336(2)
Maps
338(3)
Sorted Sets and Sorted Maps
341(4)
Customizing Collections
345(6)
Review Questions
348(1)
Chapter Summary
349(1)
Programming Exercise
350(1)
AWT Components
351(31)
Overview of the java.awt package
352(1)
Components and Containers
352(7)
Component Class
353(2)
Container Class
355(1)
Panel Class
355(1)
Applet Class
355(1)
Window Class
355(1)
Frame Class
356(1)
Dialog Class
357(1)
Review Questions
357(2)
GUI Control Components
359(18)
Running the Examples
360(1)
Button
361(1)
Canvas
362(1)
Checkbox and CheckboxGroup
363(2)
Choice
365(1)
Label
366(1)
List
367(2)
Scrollbar
369(3)
TextField and TextArea
372(3)
Review Questions
375(2)
Menu Components
377(5)
Review Questions
380(1)
Chapter Summary
381(1)
Programming Exercise
381(1)
Layout Management
382(30)
Layout Management Policies
383(3)
Layout Managers
383(1)
Common Methods for Designing a Layout
384(1)
Communication between Container and Layout Manager
384(1)
Layout and Preferred Size
385(1)
Review Questions
386(1)
Running the Example Code
386(1)
FlowLayout Manager
387(2)
Review Questions
388(1)
GridLayout Manager
389(3)
Review Questions
391(1)
BorderLayout Manager
392(4)
Review Questions
396(1)
CardLayout Manager
396(3)
Review Questions
399(1)
GridBagLayout Manager
399(7)
Review Questions
405(1)
Customized Layout
406(1)
Building Component Hierarchies
407(5)
Chapter Summary
411(1)
Programming Exercises
411(1)
Event Handling
412(38)
Overview of Event Handling
413(1)
The Event Hierarchy
413(8)
AWTEvent Classes
414(1)
Semantic Event Classes
415(2)
Low-level Events
417(3)
Review Questions
420(1)
The Event Delegation Model
421(8)
Review Questions
427(2)
Event Adapters
429(4)
Evetn Listeners as Anonymous Inner Classes
432(1)
Building GUI-based Applications
433(8)
Review Questions
439(2)
Low-Level Event Processing
441(9)
Review Questions
447(1)
Chapter Summary
448(1)
Programming Exercises
448(2)
Painting
450(37)
Rendering Graphics
451(3)
Graphics Context
451(1)
Drawing Components
451(2)
The Graphics Class
453(1)
Using Color
454(4)
Review Questions
456(2)
Remdering Text and Working with Fonts
458(4)
Drawing Shapes
462(9)
Drawings Lines
462(1)
Drawing Rectangles
463(3)
Drawing Ovals
466(1)
Drawing Arcs
467(2)
Drawing Polygons
469(2)
Clipping
471(4)
Review Questions
473(2)
The AWT Thread
475(2)
Organizing Painting and Event Handling
477(4)
Painting Modes
479(2)
Handling Images
481(6)
Review Questions
485(1)
Chapter Summary
486(1)
Programming Exercise
486(1)
Applets
487(22)
Creating Applets
488(1)
Running Applets
488(7)
HTML APPLET Element
489(2)
HTML OBJECT Element
491(1)
Applet Layout Management Specification
491(2)
Applet Code Specification
493(2)
Applet Life Cycle
495(2)
Review Questions
496(1)
Applets and Threads
497(3)
Other Useful Methods of the Applet Class
500(1)
Supplying Applet Parameters
501(2)
Using Images and Sound in Applets
503(2)
JAR Files
505(1)
Applet Security
506(3)
Review Questions
507(1)
Chapter Summary
508(1)
Programming Exercises
508(1)
Swing
509(39)
Swing Overview
510(2)
Heavyweight and Lightweight Components
511(1)
Swing and the AWT
511(1)
Swing Packages
512(1)
The Root Pane Container Model
512(4)
Swing Components
516(15)
Root Containers
517(1)
JComponent
518(1)
Labels and Buttons
519(2)
Basic Components
521(2)
Text Components
523(2)
Space-saving Components
525(1)
Components with Complex Models
526(3)
Large Compound Components
529(1)
Review Questions
530(1)
Other Swing Topics
531(9)
BoxLayout
531(3)
Look and Feel
534(1)
Alternatives to Traditional Event Handling
535(3)
The Single-Thread Rule
538(1)
Review Questions
538(2)
Building a GUI with Swing
540(8)
Chapter Summary
547(1)
Programming Exercise
547(1)
Files and Streams
548(45)
Input and Output
549(1)
File Class
549(6)
Querying the File System
551(2)
File or Directory Existence
553(1)
Read and Write Access
553(1)
Listing Directory Entries
553(1)
Creating New Files and Directories
554(1)
Renaming Files and Directories
554(1)
Deleting Files and Directories
554(1)
Byte Streams: Input Streams and Output Streams
555(12)
File Streams
558(2)
Filter Streams
560(1)
I/O of Java Primitive Values
560(3)
Buffered Byte Streams
563(1)
Comparison of Byte Output Streams and Input Streams
564(1)
Review Questions
565(2)
Character Streams: Readers and Writers
567(16)
Character Encodings
570(1)
Print Writers
571(1)
Writing Text Files
572(2)
Reading Text Files
574(1)
Buffer Character Streams
575(1)
Using Buffered Writers
575(1)
Using Buffered Readers
576(3)
Terminal I/O
579(2)
Comparison of Character Writers and Readers
581(1)
Comparison of Byte Streams and Character Streams
581(1)
Review Questions
582(1)
Random Access for Files
583(4)
Review Questions
586(1)
Object Serialization
587(6)
ObjectOutputStream Class
587(1)
ObjectInputStream Class
588(3)
Review Questions
591(1)
Chapter Summary
591(1)
Programming Exercise
592(1)
Javadoc Facility
593(14)
Javadoc Facility
594(2)
Using Tags
596(5)
Javadoc Tags for Classes, Interfaces and Members
597(2)
Documenting Classes and Interfaces
599(1)
Documenting Methods
600(1)
Documenting Member Variables
600(1)
Some Documentation Conventions
601(1)
Running javadoc
601(6)
Common Pitfalls when Using Javadoc
604(1)
Review Questions
604(2)
Chapter Summary
606(1)
Programming Exercise
606(1)
A Taking the SCPJ2 Exam 607(9)
Preparing for the programmer exam
607(1)
Registering for the exam
608(3)
Obtaining an exam voucher
608(1)
Signing up for the test
608(1)
Contact information
609(2)
After taking the exam
611(1)
Moving on to the developer exam
611(1)
How the examination is conducted
612(1)
The testing locations
612(1)
Utilizing the allotted time
612(1)
The exam program
612(1)
The questions
613(3)
Forms of answers expected
613(1)
Forms of questions
614(1)
Topics covered by the questions
614(2)
B Objectives for the SCPJ2 Exam 616(7)
C Annotated Answers to Review Questions 623(43)
D Solutions to Programming Exercises 666(32)
E Sample Exam 698(31)
Index 729

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >