Java The Complete Reference, Seventh Edition

Java The Complete Reference, Seventh Edition

by Herbert Schildt, Schildt Herbert

Paperback

$49.99

Product Details

ISBN-13: 9780072263855
Publisher: McGraw-Hill Companies, The
Publication date: 12/01/2006
Series: Osborne Complete Reference Series
Pages: 1024
Product dimensions: 7.40(w) x 9.20(h) x 2.01(d)

About the Author

Herbert Schildt is a leading authority on Java, C, C++, and C#. His programming books have sold more than 3.5 million copies worldwide and have been translated into all major foreign languages. Herb is the author of numerous bestsellers, including The Art of Java, Java: A Beginner's Guide, Swing: A Beginner's Guide, and many others.

Table of Contents


Preface     xix
Java Fundamentals     1
The Origins of Java     2
How Java Relates to C and C++     3
How Java Relates to C#     4
Java's Contribution to the Internet     5
Java Applets     5
Security     5
Portability     6
Java's Magic: The Bytecode     6
The Java Buzzwords     7
Object-Oriented Programming     9
Encapsulation     10
Polymorphism     10
Inheritance     11
Obtaining the Java Development Kit     12
A First Simple Program     12
Entering the Program     13
Compiling the Program     14
The First Sample Program Line by Line     14
Handling Syntax Errors     17
A Second Simple Program     18
Another Data Type     20
Converting Gallons to Liters     22
Two Control Statements     23
The if Statement     23
The for Loop     25
Create Blocks of Code     27
Semicolons and Positioning     29
Indentation Practices     29
Improving the Gallons-to-LitersConverter     30
The Java Keywords     32
Identifiers in Java     32
The Java Class Libraries     33
Mastery Check     34
Introducing Data Types and Operators     35
Why Data Types Are Important     36
Java's Primitive Types     36
Integers     37
Floating-Point Types     39
Characters     39
The Boolean Type     41
How Far Away Is the Lightning?     43
Literals     44
Hexadecimal and Octal Constants     44
Character Escape Sequences     45
String Literals     45
A Closer Look at Variables     47
Initializing a Variable     47
Dynamic Initialization     48
The Scope and Lifetime of Variables     49
Operators     52
Arithmetic Operators     52
Increment and Decrement     54
Relational and Logical Operators     55
Short-Circuit Logical Operators     57
The Assignment Operator     58
Shorthand Assignments     60
Type Conversion in Assignments     61
Casting Incompatible Types      62
Operator Precedence     64
Display a Truth Table for the Logical Operators     65
Expressions     66
Type Conversion in Expressions     66
Spacing and Parentheses     68
Mastery Check     69
Program Control Statements     71
Input Characters from the Keyboard     72
The if Statement     74
Nested ifs     75
The if-else-if Ladder     76
The switch Statement     78
Nested switch Statements     82
Start Building a Java Help System     83
The for Loop     86
Some Variations on the for Loop     87
Missing Pieces     88
Loops with No Body     90
Declaring Loop Control Variables Inside the for Loop     91
The Enhanced for Loop     92
The while Loop     92
The do-while Loop     94
Improve the Java Help System     97
Use break to Exit a Loop     100
Use break as a Form of goto     102
Use continue     106
Finish the Java Help System     109
Nested Loops     112
Mastery Check     113
Introducing Classes, Objects, and Methods     115
Class Fundamentals     116
The General Form of a Class     116
Defining a Class     117
How Objects Are Created     121
Reference Variables and Assignment     121
Methods     122
Adding a Method to the Vehicle Class     123
Returning from a Method     125
Returning a Value     126
Using Parameters     129
Adding a Parameterized Method to Vehicle     130
Creating a Help Class     133
Constructors     139
Parameterized Constructors     140
Adding a Constructor to the Vehicle Class     141
The new Operator Revisited     142
Garbage Collection and Finalizers     143
The finalize() Method     144
Demonstrate Finalization     145
The this Keyword     147
Mastery Check     149
More Data Types and Operators     151
Arrays     152
One-Dimensional Arrays     152
Sorting an Array     156
Multidimensional Arrays     158
Two-Dimensional Arrays     158
Irregular Arrays     160
Arrays of Three or More Dimensions     161
Initializing Multidimensional Arrays     161
Alternative Array Declaration Syntax     163
Assigning Array References     164
Using the length Member     165
A Queue Class     168
The For-Each Style for Loop     172
Iterating Over Multidimensional Arrays     175
Applying the Enhanced for     177
Strings     178
Constructing Strings     178
Operating on Strings     179
Arrays of Strings     181
Strings Are Immutable     182
Using Command-Line Arguments     183
The Bitwise Operators     185
The Bitwise AND, OR, XOR, and NOT Operators     186
The Shift Operators     191
Bitwise Shorthand Assignments     193
A ShowBits Class     193
The ? Operator     196
Mastery Check     198
A Closer Look at Methods and Classes     201
Controlling Access to Class Members     202
Java's Access Specifiers     202
Improving the Queue Class     208
Pass Objects to Methods     209
How Arguments Are Passed      211
Returning Objects     214
Method Overloading     216
Overloading Constructors     222
Overloading the Queue Constructor     225
Recursion     228
Understanding static     230
Static Blocks     233
The Quicksort     235
Introducing Nested and Inner Classes     238
Varargs: Variable-Length Arguments     242
Varargs Basics     242
Overloading Varargs Methods     246
Varargs and Ambiguity 247
Mastery Check     249
Inheritance     251
Inheritance Basics     252
Member Access and Inheritance     255
Constructors and Inheritance     258
Using super to Call Superclass Constructors     260
Using super to Access Superclass Members     266
Extending the Vehicle Class     267
Creating a Multilevel Hierarchy     270
When Are Constructors Called?     273
Superclass References and Subclass Objects     274
Method Overriding     280
Overridden Methods Support Polymorphism     283
Why Overridden Methods?     285
Applying Method Overriding to TwoDShape     285
Using Abstract Classes     290
Using final     295
Final Prevents Overriding     295
Final Prevents Inheritance     295
Using final with Data Members     296
The Object Class     298
Mastery Check     299
Packages and Interfaces     301
Packages     302
Defining a Package     302
Finding Packages and Classpath     304
A Short Package Example     304
Packages and Member Access     306
A Package Access Example     307
Understanding Protected Members     309
Importing Packages     311
Java's Class Library Is Contained in Packages     314
Interfaces     315
Implementing Interfaces     316
Using Interface References     320
Creating a Queue Interface     322
Variables in Interfaces     328
Interfaces Can Be Extended     329
Mastery Check     330
Exception Handling     333
The Exception Hierarchy     334
Exception Handling Fundamentals     334
Using try and catch     335
A Simple Exception Example     336
The Consequences of an Uncaught Exception     339
Exceptions Enable You to Handle Errors Gracefully     340
Using Multiple catch Statements     342
Catching Subclass Exceptions     343
Try Blocks Can Be Nested     344
Throwing an Exception     346
Rethrowing an Exception     346
A Closer Look at Throwable     348
Using finally     350
Using throws     352
Java's Built-in Exceptions     354
Creating Exception Subclasses     356
Adding Exceptions to the Queue Class     359
Mastery Check     362
Using I/O     365
Java's I/O Is Built upon Streams     366
Byte Streams and Character Streams     366
The Byte Stream Classes     367
The Character Stream Classes     367
The Predefined Streams     367
Using the Byte Streams     370
Reading Console Input     370
Writing Console Output     372
Reading and Writing Files Using Byte Streams     373
Inputting from a File     374
Writing to a File     376
Reading and Writing Binary Data     378
A File Comparison Utility      382
Random Access Files     384
Using Java's Character-Based Streams     388
Console Input Using Character Streams     389
Console Output Using Character Streams     392
File I/O Using Character Streams     394
Using a FileWriter     394
Using a FileReader     395
Using Java's Type Wrappers to Convert Numeric Strings     397
Creating a Disk-Based Help System     400
Mastery Check     406
Multithreaded Programming     407
Multithreading Fundamentals     408
The Thread Class and Runnable Interface     409
Creating a Thread     410
Some Simple Improvements     413
Extending Thread     415
Creating Multiple Threads     418
Determining When a Thread Ends     421
Thread Priorities     424
Synchronization     428
Using Synchronized Methods     428
The synchronized Statement     431
Thread Communication Using notify(), wait(), and notifyAll()     434
An Example That Uses wait() and notify()     435
Suspending, Resuming, and Stopping Threads     441
Using the Main Thread      445
Mastery Check     447
Enumerations, Autoboxing, and Static Import     449
Enumerations     450
Enumeration Fundamentals     451
Java Enumerations Are Class Types     454
The values() and valueOf() Methods     454
Constructors, Methods, Instance Variables, and Enumerations     456
Two Important Restrictions     458
Enumerations Inherit Enum     458
A Computer-Controlled Traffic Light     460
Autoboxing     466
Type Wrappers     467
Autoboxing Fundamentals     469
Autoboxing and Methods     470
Autoboxing/Unboxing Occurs in Expressions     472
A Word of Warning     473
Static Import     474
Annotations (Metadata)     478
Mastery Check     481
Generics     483
Generics Fundamentals     484
A Simple Generics Example     485
Generics Work Only with Objects     489
Generic Types Differ Based on Their Type Arguments     489
A Generic Class with Two Type Parameters     490
The General Form of a Generic Class     492
Bounded Types     492
Using Wildcard Arguments     496
Bounded Wildcards     500
Generic Methods     503
Generic Constructors     506
Generic Interfaces     507
Create a Generic Queue     510
Raw Types and Legacy Code     515
Erasure     518
Ambiguity Errors     519
Some Generic Restrictions     521
Type Parameters Can't Be Instantiated     521
Restrictions on Static Members     522
Generic Array Restrictions     522
Generic Exception Restriction     524
Continuing Your Study of Generics     524
Mastery Check     524
Applets, Events, and Miscellaneous Topics     527
Applet Basics     528
Applet Organization and Essential Elements     532
The Applet Architecture     532
A Complete Applet Skeleton     532
Applet Initialization and Termination     534
Requesting Repainting     535
The update() Method     536
A Simple Banner Applet     536
Using the Status Window     540
Passing Parameters to Applets     541
The Applet Class     543
Event Handling      543
The Delegation Event Model     545
Events     545
Event Sources     546
Event Listeners     546
Event Classes     546
Event Listener Interfaces     547
Using the Delegation Event Model     549
Handling Mouse Events     549
A Simple Mouse Event Applet     550
More Java Keywords     553
The transient and volatile Modifiers     553
Instanceof     554
Strictfp     554
Assert     555
Native Methods     555
Mastery Check     557
Introducing Swing     559
The Origins and Design Philosophy of Swing     560
Components and Containers     563
Components     563
Containers     564
The Top-Level Container Panes     564
Layout Managers     565
A First Simple Swing Program     566
The First Swing Example Line by Line     568
Use JButton     573
Work with JTextField     577
Create a JCheckBox     582
Work with JList     585
A Swing-Based File Comparison Utility     589
Use Anonymous Inner Classes to Handle Events     597
Create a Swing Applet     597
What Next?     600
Mastery Check     601
Answers to Mastery Checks     603
Using Java's Documentation Comments     655
The javadoc Tags     656
@author     657
{lcub}@code{rcub}     657
@deprecated     657
{lcub}@docRoot{rcub}     658
@exception     658
{lcub}@inheritDoc{rcub}     658
{lcub}@link{rcub}     658
{lcub}@linkplain{rcub}     658
{lcub}@literal{rcub}     658
@param     659
@return     659
@see     669
@serial     659
@serialData     660
@serialField     660
@since     660
@throws     660
{lcub}@value{rcub}     660
@version     661
The General Form of a Documentation Comment     661
What javadoc Outputs     661
An Example that Uses Documentation Comments     662
Index     665

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews

Java The Complete Reference, Seventh Edition 3.3 out of 5 based on 0 ratings. 8 reviews.
Anonymous More than 1 year ago
I Refered this book for any doubts I am getting. Really this is a nice book ..
Anonymous More than 1 year ago
Anonymous More than 1 year ago
Anonymous More than 1 year ago
Anonymous More than 1 year ago
Anonymous More than 1 year ago
Pads in and looks around
Anonymous More than 1 year ago
Was tht an insult amd no ur not the boss of me.
myreviewAP More than 1 year ago
Hi everybody I noticed one mistake is that in the concept of multilevel hierarchy the instance variable declared as private in super class but its subclass accessed its super class variables which are declared as private.