Part I: The Java Language |
The History and Evolution of Java |
Java's Lineage |
The Creation of Java |
How Java Changed the Internet |
Java's Magic: The Bytecode |
Servlets: Java on the Server Side |
The Java Buzzwords |
The Evolution of Java |
A Culture of Innovation |
An Overview of Java |
Object-Oriented Programming |
A First Simple Program |
A Second Short Program |
Two Control Statements |
Using Blocks of Code |
Lexical Issues |
The Java Class Libraries |
Data Types, Variables, and Arrays |
Java Is a Strongly Typed Language |
The Primitive Types |
Integers |
Floating-Point Types |
Characters |
Booleans |
A Closer Look at Literals |
Variables |
Type Conversion and Casting |
Automatic Type Promotion in Expressions |
Arrays |
A Few Words About Strings |
A Note to C/C++ Programmers About Pointers |
Operators |
Arithmetic Operators |
The Bitwise Operators |
Relational Operators |
Boolean Logical Operators |
The Assignment Operator |
The ? Operator |
Operator Precedence |
Using Parentheses |
Control Statements |
Java's Selection Statements |
Iteration Statements |
Jump Statements |
Introducing Classes |
Class Fundamentals |
Declaring Objects |
Assigning Object Reference Variables |
Introducing Methods |
Constructors |
The this Keyword |
Garbage Collection |
The finalize( ) Method |
A Stack Class |
A Closer Look at Methods and Classes |
Overloading Methods |
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 |
Varargs: Variable-Length Arguments |
Inheritance |
Inheritance Basics |
Using super |
Creating a Multilevel Hierarchy |
When Constructors Are Called |
Method Overriding |
Dynamic Method Dispatch |
Using Abstract Classes |
Using final with Inheritance |
The Object Class |
Packages and Interfaces |
Packages |
Access Protection |
Importing Packages |
Interfaces |
Exception Handling |
Exception-Handling Fundamentals |
Exception Types |
Uncaught Exceptions |
Using try and catch |
Multiple catch Clauses |
Nested try Statements |
throw |
throws |
finally |
Java's Built-in Exceptions |
Creating Your Own Exception Subclasses |
Chained Exceptions |
Using Exceptions |
Multithreaded Programming |
The Java Thread Model |
The Main Thread |
Creating a Thread |
Creating Multiple Threads |
Using isAlive( ) and join( ) |
Thread Priorities |
Synchronization |
Interthread Communication |
Suspending, Resuming, and Stopping Threads |
Using Multithreading |
Enumerations, Autoboxing, and Annotations (Metadata) |
Enumerations |
Type Wrappers |
Autoboxing |
Annotations (Metadata) |
I/O, Applets, and Other Topics |
I/O Basics |
Reading Console Input |
Writing Console Output |
The PrintWriter Class |
Reading and Writing Files |
Applet Fundamentals |
The transient and volatile Modifiers |
Using instanceof |
strictfp |
Native Methods |
Using assert |
Static Import |
Invoking Overloaded Constructors Through this( ) |
Generics |
What Are Generics? |
A Simple Generics Example |
A Generic Class with Two Type Parameters |
The General Form of a Generic Class |
Bounded Types |
Using Wildcard Arguments |
Creating a Generic Method |
Generic Interfaces |
Raw Types and Legacy Code |
Generic Class Hierarchies |
Erasure |
Ambiguity Errors |
Some Generic Restrictions |
Final Thoughts on Generics |
Part II: The Java Library |
String Handling |
The String Constructors |
String Length |
Special String Operations |
Character Extraction |
String Comparison |
Searching Strings |
Modifying a String |
Data Conversion Using valueOf( ) |
Changing the Case of Characters Within a String |
Additional String Methods |
StringBuffer |
StringBuilder |
Exploring java.lang |
Primitive Type Wrappers |
Void |
Process |
Runtime |
ProcessBuilder |
System |
Object |
Using clone( ) and the Cloneable Interface |
Class |
ClassLoader |
Math |
StrictMath |
Compiler |
Thread, ThreadGroup, and Runnable |
ThreadLocal and InheritableThreadLocal |
Package |
RuntimePermission |
Throwable |
SecurityManager |
StackTraceElement |
Enum |
The CharSequence Interface |
The Comparable Interface |
The Appendable Interface |
The Iterable Interface |
The Readable Interface |
The java.lang Subpackages |
java.util Part 1: The Collections Framework |
Collections Overview |
Recent Changes to Collections |
The Collection Interfaces |
The Collection Classes |
Accessing a Collection via an Iterator |
Storing User-Defined Classes in Collections |
The RandomAccess Interface |
Working with Maps |
Comparators |
The Collection Algorithms |
Arrays |
Why Generic Collections? |
The Legacy Classes and Interfaces |
Parting Thoughts on Collections |
java.util Part 2: More Utility Classes |
StringTokenizer |
BitSet |
Date |
Calendar |
GregorianCalendar |
TimeZone |
SimpleTimeZone |
Locale |
Random |
Observable |
Timer and TimerTask |
Currency |
Formatter |
Scanner |
The ResourceBundle, ListResourceBundle, and PropertyResourceBundle Classes |
Miscellaneous Utility Classes and Interfaces |
The java.util Subpackages |
Input/Output: Exploring java.io |
The Java I/O Classes and Interfaces |
File |
The Closeable and Flushable Interfaces |
The Stream Classes |
The Byte Streams |
The Character Streams |
The Console Class |
Using Stream I/O |
Serialization |
Stream Benefits |
Networking |
Networking Basics |
The Networking Classes and Interfaces |
InetAddress |
Inet4Address and Inet6Address |
TCP/IP Client Sockets |
URL |
URLConnection |
HttpURLConnection |
The URI Class |
Cookies |
TCP/IP Server Sockets |
Datagrams |
The Applet Class |
Two Types of Applets |
Applet Basics |
Applet Architecture |
An Applet Skeleton |
Simple Applet Display Methods |
Requesting Repainting |
Using the Status Window |
The HTML APPLET Tag |
Passing Parameters to Applets |
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 |
Event Classes |
Sources of Events |
Event Listener Interfaces |
Using the Delegation Event Model |
Adapter Classes |
Inner Classes |
Introducing the AWT: Working with Windows, Graphics, and Text |
AWT Classes |
Window Fundamentals |
Working with Frame Windows |
Creating a Frame Window in an Applet |
Creating a Windowed Program |
Displaying Information Within a Window |
Working with Graphics |
Working with Color |
Setting the Paint Mode |
Working with Fonts |
Managing Text Output Using FontMetrics |
Using AWT Controls, Layout Managers, and Menus |
Control Fundamentals |
Labels |
Using Buttons |
Applying Check Boxes |
CheckboxGroup |
Choice Controls |
Using Lists |
Managing Scroll Bars |
Using a TextField |
Using a TextArea |
Understanding Layout Managers |
Menu Bars and Menus |
Dialog Boxes |
FileDialog |
Handling Events by Extending AWT Components |
Images |
File Formats |
Image Fundamentals: Creating, Loading, and Displaying |
ImageObserver |
Double Buffering |
MediaTracker |
ImageProducer |
ImageConsumer |
ImageFilter |
Cell Animation |
Additional Imaging Classes |
The Concurrency Utilities |
The Concurrent API Packages |
Using Synchronization Objects |
Using an Executor |
The TimeUnit Enumeration |
The Concurrent Collections |
Locks |
Atomic Operations |
The Concurrency Utilities Versus Java's Traditional Approach |
NIO, Regular Expressions, and Other Packages |
The Core Java API Packages |
NIO |
Regular Expression Processing |
Reflection |
Remote Method Invocation (RMI) |
Text Formatting |
Part III: Software Development Using Java |
Java Beans |
What Is a Java Bean? |
Advantages of Java Beans |
Introspection |
Bound and Constrained Properties |
Persistence |
Customizers |
The Java Beans API |
A Bean Example |
Introducing Swing |
The Origins of Swing |
Swing Is Built on the AWT |
Two Key Swing Features |
The MVC Connection |
Components and Containers |
The Swing Packages |
A Simple Swing Application |
Event Handling |
Create a Swing Applet |
Painting in Swing |
Exploring Swing |
JLabel and ImageIcon |
JTextField |
The Swing Buttons |
JTabbedPane |
JScrollPane |
JList |
JComboBox |
Trees |
JTable |
Continuing Your Exploration of Swing |
Servlets |
Background |
The Life Cycle of a Servlet |
Using Tomcat for Servlet Development |
A Simple Servlet |
The Servlet API |
The javax.servlet Package |
Reading Servlet Parameters |
The javax.servlet.http Package |
Handling HTTP Requests and Responses |
Using Cookies |
Session Tracking |
Part IV: Applying |
Financial Applets and Servlets |
Finding the Payments for a Loan |
Finding the Future Value of an Investment |
Finding the Initial Investment Required to Achieve a Future Value |
Finding the Initial Investment Needed for a Desired Annuity |
Finding the Maximum Annuity for a Given Investment |
Finding the Remaining Balance on a Loan |
Creating Financial Servlets |
Some Things to Try |
Creating a Download Manager in Java |
Understanding Internet Downloads |
An Overview of the Download Manager |
The Download Class |
The ProgressRenderer Class |
The DownloadsTableModel Class |
The DownloadManager Class |
Compiling and Running the Download Manager |
Enhancing the Download Manager |
Using Java's Documentation Comments |
The javadoc Tags |
@author |
{@code} |
@deprecated |
{@docRoot} |
@exception |
{@inheritDoc} |
{@link} |
{@linkplain} |
{@literal} |
@param |
@return |
@see |
@serial |
@serialData |
@serialField |
@since |
@throws |
{@value} |
@version |
The General Form of a Documentation Comment |
What javadoc Outputs |
An Example that Uses Documentation Comments |