Clicking one one of the buttons will make your browser jump to the appropriate section of the table of contents below. Note the use of the status line.

Java in a Nutshell: Table of Contents


How to Use This Book   xi
Preface   xvii


Part I:  Introducing Java:

Section 1: Getting Started with Java   3
 Why Java? 4
 What Is Java? 4
 A Simple Example 10

Section 2: How Java Differs from C   15
 Program Structure and Environment 15
 The Name Space: Packages, Classes, and Fields 17
 Comments 21
 No Preprocessor 21
 Unicode and Character Escapes 23
 Primitive Data Types 24
 Reference Data Types 25
 Objects 28
 Arrays 29
 Strings 33
 Operators 33
 Statements 35
 Exceptions and Exception Handling 39
 Miscellaneous Differences 45

Section 3: Classes and Objects in Java   49
 Introduction to Classes and Objects 50
 Object Creation 52
 Class Variables 54
 Class Methods 56
 Object Destruction 60
 Subclasses and Inheritance 62
 Overriding Methods 68
 Data Hiding and Encapsulation 71
 Abstract Classes and Interfaces 75
 C++ Features Not Found in Java 80
 Section Summary 80


Part II:  Programming with the Java API

Section 4: Applets   85
 A First Applet 85
 Drawing Graphics 86
 Handling Events 88
 Events in Detail 89
 Reading Applet Parameters 92
 Adding a Button 93
 An Imagemap 95
 Animation 98
 Sound 100
 Standalone Applets 101

Section 5: Graphical User Interfaces   103
 An Information Dialog 103
 A Dialog with User Response 106
 All Java GUI Components 108
 Handling GUI Events 114
 Working with Scrollbars 117
 Defining a Custom Component 120

Section 6: Input and Output   125
 Reading and Displaying Files 125
 Getting Directory and File Information 127
 Copying a File 131
 Filtering Input 133
 Pipes 135

Section 7: Networking   141
 Downloading the Contents of a URL 141
 Using a URLConnection 142
 Sending and Receiving Datagrams 143
 Implementing a Server 145
 Implementing a Client 147
 An Applet Client 149

Section 8: Advanced Graphics and Images  151
 Smooth Animation 151
 Keeping Track of Images 155
 Filtering Images 157

Section 9: Advanced Threads   161
 Threads and Thread Groups 161
 synchronized, wait(), and notify() 164
 A Multithreaded Client 169


Part III:  Java Language Reference 

Section 10: Java Syntax   175
 Primitive Data Types 175
 Character Escape Sequences 176
 Operators 176
 Modifiers 179
 Reserved Words 181
 Java Documentation Comment Syntax 181

Section 11: Events   183
 Event Types 183
 Key and Modifier Constants 185
 Mouse Buttons 186

Section 12: Fonts, Colors, and Cursors   187
 Fonts 187
 Colors 189
 Cursors 190

Section 13: System Properties and Applet Parameters  193
 Standard System Properties 193
 Other Important Properties 194
 Specifying Property Values 195
 Applet Parameters 195

Section 14: Applet Security   197
 Applet Security Restrictions 197
 Loading Classes Securely 199
 Denial of Service Attacks 199
 Future Directions: Applet Certification 200

Section 15: Java-Related HTML and HTTP Syntax  201
 The <APPLET> Tag 201
 The <EMBED> Tag 203
 Java-Related HTTP 203

Section 16: The Unicode Standard   205

The UTF-8 Encoding 208

Section 17: JDK Development Tools   211
 appletviewer -- The Java Applet Viewer 211
 java -- The Java Interpreter 214
 javac -- The Java Compiler 218
 javadoc -- The Java Documentation Generator 220
 javah -- Native Method C File Generator 222
 javap -- The Java Class Disassembler 224
 jdb -- The Java Debugger 226


Part IV:  API Quick Reference 

Section 18 -- The java.applet Package   233
Section 19 -- The java.awt Package   237
Section 20 -- The java.awt.image Package   271
Section 21 -- The java.awt.peer Package   281
Section 22 -- The java.io Package   289
Section 23 -- The java.lang Package   309
Section 24 -- The java.net Package   329
Section 25 -- The java.util Package   339
Section 26 -- Java Errors and Exceptions   349


Part V:  API Cross References 

Section 27 -- Class Defined-In Index   367
Section 28 -- Method Defined-In Index   371
Section 29 -- Subclass Index   381
Section 30 -- Implemented-By Index   383
Section 31 -- Returned-By Index   385
Section 32 -- Passed-To Index   389
Section 33 -- Thrown-By Index   395

Glossary   399
Index   421