Skip to content

Java 2 The Complete Reference

Best in textbook rentals since 2012!

ISBN-10: 0072119764

ISBN-13: 9780072119763

Edition: 3rd 1999

Authors: Patrick Naughton, Herbert Schildt

List price: $39.99
Blue ribbon 30 day, 100% satisfaction guarantee!
what's this?
Rush Rewards U
Members Receive:
Carrot Coin icon
XP icon
You have reached 400 XP and carrot coins. That is the daily max!

This guide to Java provides a comprehensive reference and tutorial for the Java 2 specification. It shows everything needed to develop, compile, debug and run Java applications, with practical examples and details of the Java language.
Customers also bought

Book details

List price: $39.99
Edition: 3rd
Copyright year: 1999
Publisher: McGraw-Hill Osborne
Binding: Paperback
Pages: 1108
Size: 7.28" wide x 9.02" long x 2.36" tall
Weight: 4.114
Language: English

Herb Schildt (Mahomet, IL) is a leading authority on C and C++ and a best-selling author whose books have sold more than 2 million copies. His acclaimed C and C++ books include Teach Yourself C, C++ from the Ground Up, C++: The Complete Reference, Java Programmer's Reference, STL Programming from the Ground Up, Windows 98 Programming from the Ground Up, and co-author of C/C++ Annotated Archives.

Preface
Acknowledgments
The Java Language
The Genesis of Java
Java's Lineage
The Birth of Modern Programming: C
The Need for C++
The Stage Is Set for Java
The Creation of Java
Why Java Is Important to the Internet
Java Applets and Applications
Security
Portability
Java's Magic: The Bytecode
The Java Buzzwords
Simple
Object-Oriented
Robust
Multithreaded
Architecture-Neutral
Interpreted and High Performance
Distributed
Dynamic
The Continuing Revolution
Features Added by 1.1
Features Deprecated by 1.1
Features Added by 2
Features Deprecated by 2
Java Is Not an Enhanced HTML
An Overview of Java
Object-Oriented Programming
Two Paradigms
Abstraction
The Three OOP Principles
A First Simple Program
Entering the Program
Compiling the Program
A Closer Look at the First Sample Program
A Second Short Program
Two Control Statements
The if Statement
The for Loop
Using Blocks of Code
Lexical Issues
Whitespace
Identifiers
Literals
Comments
Separators
The Java Keywords
The Java Class Libraries
Data Types, Variables, and Arrays
Java Is a Strongly Typed Language
The Simple Types
Integers
byte
short
int
long
Floating-Point Types
float
double
Characters
Booleans
A Closer Look at Literals
Integer Literals
Floating-Point Literals
Boolean Literals
Character Literals
String Literals
Variables
Declaring a Variable
Dynamic Initialization
The Scope and Lifetime of Variables
Type Conversion and Casting
Java's Automatic Conversions
Casting Incompatible Types
Automatic Type Promotion in Expressions
The Type Promotion Rules
Arrays
One-Dimensional Arrays
Multidimensional Arrays
Alternative Array Declaration Syntax
A Few Words About Strings
A Note to C/C++ Programmers About Pointers
Operators
Arithmetic Operators
The Basic Arithmetic Operators
The Modulus Operator
Arithmetic Assignment Operators
Increment and Decrement
The Bitwise Operators
The Bitwise Logical Operators
The Left Shift
The Right Shift
The Unsigned Right Shift
Bitwise Operator Assignments
Relational Operators
Boolean Logical Operators
Short-Circuit Logical Operators
The Assignment Operator
The ? Operator
Operator Precedence
Using Parentheses
Control Statements
Java's Selection Statements
if
switch
Iteration Statements
while
do-while
for
Some for Loop Variations
Nested Loops
Jump Statements
Using break
Using continue
return
Introducing Classes
Class Fundamentals
The General Form of a Class
A Simple Class
Declaring Objects
A Closer Look at new
Assigning Object Reference Variables
Introducing Methods
Adding a Method to the Box Class
Returning a Value
Adding a Method That Takes Parameters
Constructors
Parameterized Constructors
The this Keyword
Instance Variable Hiding
Garbage Collection
The finalize() Method
A Stack Class
A Closer Look at Methods and Classes
Overloading Methods
Overloading Constructors
Using Objects as Parameters
A Closer Look at Argument Passing
Returning Objects
Recursion
Introducing Access Control
Understanding static
Introducing final
Arrays Revisited
Introducing Nested and Inner Classes
Exploring the String Class
Using Command-Line Arguments
Inheritance
Inheritance Basics
Member Access and Inheritance
A More Practical Example
A Superclass Variable Can Reference a Subclass Object
Using super
Using super to Call Superclass Constructors
A Second Use for super
Creating a Multilevel Hierarchy
When Constructors Are Called
Method Overriding
Dynamic Method Dispatch
Why Overridden Methods?
Applying Method Overriding
Using Abstract Classes
Using final with Inheritance
Using final to Prevent Overriding
Using final to Prevent Inheritance
The Object Class
Packages and Interfaces
Packages
Defining a Package
Understanding CLASSPATH
A Short Package Example
Access Protection
An Access Example
Importing Packages
Interfaces
Defining an Interface
Implementing Interfaces
Applying Interfaces
Variables in Interfaces
Interfaces Can Be Extended
Exception Handling
Exception-Handling Fundamentals
Exception Types
Uncaught Exceptions
Using try and catch
Displaying a Description of an Exception
Multiple catch Clauses
Nested try Statements
throw
throws
finally
Java's Built-in Exceptions
Creating Your Own Exception Subclasses
Using Exceptions
Multithreaded Programming
The Java Thread Model
Thread Priorities
Synchronization
Messaging
The Thread Class and the Runnable Interface
The Main Thread
Creating a Thread
Implementing Runnable
Extending Thread
Choosing an Approach
Creating Multiple Threads
Using is Alive() and join()
Thread Priorities
Synchronization
Using Synchronized Methods
The synchronized Statement
Interthread Communication
Deadlock
Suspending, Resuming, and Stopping Threads
Suspending, Resuming, and Stopping Threads Using Java 1.1 and Earlier
Suspending, Resuming, and Stopping Threads Using Java 2
Using Multithreading
I/O, Applets, and Other Topics
I/O Basics
Streams
Byte Streams and Character Streams
The Predefined Streams
Reading Console Input
Reading Characters
Reading Strings
Writing Console Output
The PrintWriter Class
Reading and Writing Files
Applet Fundamentals
The transient and volatile Modifiers
Using instanceof
strictfp
Native Methods
Problems with Native Methods
The Java Library
String Handling
The String Constructors
String Length
Special String Operations
String Literals
String Concatenation
String Concatenation with Other Data Types
String Conversion and toString()
Character Extraction
charAt()
getChars()
getBytes()
toCharArray()
String Comparison
equals() and equalsIgnoreCase()
regionMatches()
startsWith() and endsWith()
equals() Versus ==
compareTo()
Searching Strings
Modifying a String
substring()
concat()
replace()
trim()
Data Conversion Using valueOf()
Changing the Case of Characters Within a String
StringBuffer
StringBuffer Constructors
length() and capacity()
ensureCapacity()
setLength()
charAt() and setCharAt()
getChars()
append()
insert()
reverse()
delete() and deleteCharAt()
replace()
substring()
Exploring java.lang
Simple Type Wrappers
Number
Double and Float
Byte, Short, Integer, and Long
Character
Boolean
Void
Process
Runtime
Memory Management
Executing Other Programs
System
Using currentTimeMillis() to Time Program Execution
Using arraycopy()
Environment Properties
Object
Using clone() and the Cloneable Interface
Class
ClassLoader
Math
Transcendental Functions
Exponential Functions
Rounding Functions
Miscellaneous Math Methods
Compiler
Thread, ThreadGroup, and Runnable
The Runnable Interface
Thread
ThreadGroup
ThreadLocal and Inheritable ThreadLocal
Package
RuntimePermission
Throwable
SecurityManager
The Comparable Interface
The java.lang.ref and java.lang.reflect Packages
java.lang.ref
java.lang.reflect
java.util Part 1: The Collections Framework
Collections Overview
The Collection Interfaces
The Collection Interface
The List Interface
The Set Interface
The SortedSet Interface
The Collection Classes
The ArrayList Class
The LinkedList Class
The HashSet Class
The TreeSet Class
Accessing a Collection via an Iterator
Using an Iterator
Storing User-Defined Classes in Collections
Working with Maps
The Map Interfaces
The Map Classes
Comparators
Using a Comparator
The Collection Algorithms
Arrays
The Legacy Classes and Interfaces
The Enumeration Interface
Vector
Stack
Dictionary
Hashtable
Properties
Using store() and load()
Collections Summary
java.util Part 2: More Utility Classes
StringTokenizer
BitSet
Date
Date Comparison
Calendar
GregorianCalendar
TimeZone
SimpleTimeZone
Locale
Random
Observable
The Observer Interface
An Observer Example
The java.util.zip Package
The java.util.jar Package
Input/Output: Exploring java.io
The Java I/O Classes and Interfaces
File
Directories
Using FilenameFilter
The listFiles() Alternative
Creating Directories
The Stream Classes
The Byte Streams
InputStream
OutputStream
FileInputStream
FileOutputStream
ByteArrayInputStream
ByteArrayOutputStream
Filtered Byte Streams
Buffered Byte Streams
SequenceInputStream
PrintStream
RandomAccessFile
The Character Streams
Reader
Writer
FileReader
FileWriter
CharArrayReader
CharArrayWriter
BufferedReader
BufferedWriter
PushbackReader
PrintWriter
Using Stream I/O
Improving wc() Using a StreamTokenizer
Serialization
Serializable
Externalizable
ObjectOutput
ObjectOutputStream
ObjectInput
ObjectInputStream
A Serialization Example
Stream Benefits
Networking
Networking Basics
Socket Overview
Client/Server
Reserved Sockets
Proxy Servers
Internet Addressing
Java and the Net
The Networking Classes and Interfaces
InetAddress
Factory Methods
Instance Methods
TCP/IP Client Sockets
Whois
URL
Format
URLConnection
TCP/IP Server Sockets
A Caching Proxy HTTP Server
Source Code
Datagrams
DatagramPacket
Datagram Server and Client
Net Worth
The Applet Class
Applet Basics
The Applet Class
Applet Architecture
An Applet Skeleton
Applet Initialization and Termination
Overriding update()
Simple Applet Display Methods
Requesting Repainting
A Simple Banner Applet
Using the Status Window
The HTML Applet Tag
Passing Parameters to Applets
Improving the Banner Applet
getDocumentBase() and getCodeBase()
AppletContext and showDocument()
The AudioClip Interface
The AppletStub Interface
Outputting to the Console
Event Handling
Two Event Handling Mechanisms
The Delegation Event Model
Events
Event Sources
Event Listeners
Event Classes
The ActionEvent Class
The AdjustmentEvent Class
The ComponentEvent Class
The ContainerEvent Class
The FocusEvent Class
The InputEvent Class
The ItemEvent Class
The KeyEvent Class
The MouseEvent Class
The TextEvent Class
The WindowEvent Class
Sources of Events
Event Listener Interfaces
The ActionListener Interface
The AdjustmentListener Interface
The ComponentListener Interface
The ContainerListener Interface
The FocusListener Interface
The ItemListener Interface
The KeyListener Interface
The MouseListener Interface
The MouseMotionListener Interface
The TextListener Interface
The WindowListener Interface
Using the Delegation Event Model
Handling Mouse Events
Handling Keyboard Events
Adapter Classes
Inner Classes
Anonymous Inner Classes
Introducing the AWT: Working with Windows, Graphics, and Text
AWT Classes
Window Fundamentals
Component
Container
Panel
Window
Frame
Canvas
Working with Frame Windows
Setting the Window's Dimensions
Hiding and Showing a Window
Setting a Window's Title
Closing a Frame Window
Creating a Frame Window in an Applet
Handling Events in a Frame Window
Creating a Windowed Program
Displaying Information Within a Window
Working with Graphics
Drawing Lines
Drawing Rectangles
Drawing Ellipses and Circles
Drawing Arcs
Drawing Polygons
Sizing Graphics
Working with Color
Color Methods
Setting the Current Graphics Color
A Color Demonstration Applet
Setting the Paint Mode
Working with Fonts
Determining the Available Fonts
Creating and Selecting a Font
Obtaining Font Information
Managing Text Output Using FontMetrics
Displaying Multiple Lines of Text
Centering Text
Multiline Text Alignment
Exploring Text and Graphics
Using AWT Controls, Layout Managers, and Menus
Control Fundamentals
Adding and Removing Controls
Responding to Controls
Labels
Using Buttons
Handling Buttons
Applying Check Boxes
Handling Check Boxes
CheckboxGroup
Choice Controls
Handling Choice Lists
Using Lists
Handling Lists
Managing Scroll Bars
Handling Scroll Bars
Using a TextField
Handling a TextField
Using a TextArea
Understanding Layout Managers
FlowLayout
BorderLayout
Using Insets
GridLayout
CardLayout
Menu Bars and Menus
Dialog Boxes
FileDialog
Handling Events by Extending AWT Components
Extending Button
Extending Checkbox
Extending a Check Box Group
Extending Choice
Extending List
Extending Scrollbar
Exploring the Controls, Menus, and Layout Managers
Images
File Formats
Image Fundamentals: Creating, Loading, and Displaying
Creating an Image Object
Loading an Image
Displaying an Image
ImageObserver
ImageObserver Example
Double Buffering
MediaTracker
ImageProducer
MemoryImageSource
ImageConsumer
PixelGrabber
ImageFilter
CropImageFilter
RGBImageFilter
Cell Animation
Additional Java 2 Imaging Classes
Additional Packages
The Core Java API Packages
Reflection
Remote Method Invocation (RMI)
A Simple Client/Server Application Using RMI
Text Formatting
DateFormat Class
SimpleDateFormat Class
Software Development Using Java
Java Beans
What Is a Java Bean?
Advantages of Java Beans
Application Builder Tools
The Bean Developer Kit (BDK)
Installing the BDK
Starting the BDK
Using the BDK
JAR Files
Manifest Files
The JAR Utility
Introspection
Design Patterns for Properties
Design Patterns for Events
Methods
Developing a Simple Bean
Create a New Bean
Using Bound Properties
Steps
Using the BeanInfo Interface
Constrained Properties
Persistence
Customizers
The Java Beans API
Beans Are the Future
A Tour of Swing
JApplet
Icons and Labels
Text Fields
Buttons
The JButton Class
Check Boxes
Radio Buttons
Combo Boxes
Tabbed Panes
Scroll Panes
Trees
Tables
Exploring Swing
Servlets
Background
The Life Cycle of a Servlet
The Java Servlet Development Kit
A Simple Servlet
Create and Compile the Servlet Source Code
Start the servletrunner Utility
Start a Web Browser and Request the Servlet
The Servlet API
The javax.servlet Package
The Servlet Interface
The ServletConfig Interface
The ServletContext Interface
The ServletRequest Interface
The ServletResponse Interface
The SingleThreadModel Interface
The GenericServlet Class
The ServletInputStream Class
The ServletOutputStream Class
The ServletException Class
The UnavailableException Class
Reading Servlet Parameters
Reading Initialization Parameters
The javax.servlet.http Package
The HttpServletRequest Interface
The HttpServletResponse Interface
The HttpSession Interface
The HttpSessionBindingListener Interface
The HttpSessionContext Interface
The Cookie Class
The HttpServlet Class
The HttpSessionBindingEvent Class
The HttpUtils Class
Handling HTTP Requests and Responses
Handling HTTP GET Requests
Handling HTTP POST Requests
Using Cookies
Session Tracking
Security Issues
Exploring Servlets
Migrating from C++ to Java
The Differences Between C++ and Java
What Java Has Removed from C++
New Features Added by Java
Features That Differ
Eliminating Pointers
Converting Pointer Parameters
Converting Pointers that Operate on Arrays
C++ Reference Parameters Versus Java Reference Parameters
Converting C++ Abstract Classes into Java Interfaces
Converting Default Arguments
Converting C++ Multiple-Inheritance Hierarchies
Destructors Versus Finalization
Applying Java
The DynamicBillboard Applet
The APPLET Tag
Source Code Overview
DynamicBillboard.java
BillData.java
BillTransition.java
Column Transition.java
FadeTransition.java
Smash Transition.java
TearTransition.java
UnrollTransition.java
Dynamic Code
ImageMenu: An Image-Based Web Menu
The Source Image
The APPLET Tags
The Methods
init()
update()
lateInit()
paint()
mouseExited()
mouseDragged()
mouseMoved()
mouseReleased()
The Code
Summary
The Lavatron Applet: A Sports Arena Display
How Lavatron Works
The Source Code
The APPLET Tag
Lavatron.java
IntHash()
Hot Lava
Scrabblet: A Multiplayer Word Game
Network Security Concerns
The Game
Scoring
The Source Code
The APPLET Tag
Scrabblet.java
IntroCanvas.java
Board.java
Bag.java
Letter.java
ServerConnection.java
The Server Code
Server.java
ClientConnection.java
Enhancing Scrabblet
Using Java's Documentation Comments
The javadoc Tags
@author
@deprecated
@exception
{@link}
@param
@return
@see
@serial
@serialData
@serialField
@since
@throws
@version
The General Form of a Documentation Comment
What javadoc Outputs
An Example that Uses Documentation Comments
Index