| |
| |
Introduction | |
| |
| |
| |
Inside Java | |
| |
| |
Computer Programs | |
| |
| |
Data | |
| |
| |
Programming Languages | |
| |
| |
In the Beginning | |
| |
| |
How a Computer Language Becomes a Standard | |
| |
| |
And Then Java | |
| |
| |
An Inside Look at Java | |
| |
| |
Writing a Java Program from Scratch | |
| |
| |
Compiling a Java Program | |
| |
| |
Running a Java Program | |
| |
| |
Taking Apart a Java Program | |
| |
| |
Class Definition | |
| |
| |
Method Definition | |
| |
| |
Statement | |
| |
| |
Quiz | |
| |
| |
| |
Data Types and Variables | |
| |
| |
Data and Numbers | |
| |
| |
Playing with Numbering Systems | |
| |
| |
Numbers and Characters | |
| |
| |
Looking Up the Unicode Value | |
| |
| |
Literals | |
| |
| |
Integer Literals | |
| |
| |
Floating-point Literals | |
| |
| |
Boolean Literals | |
| |
| |
Character Literals | |
| |
| |
String Literals | |
| |
| |
Data Types | |
| |
| |
Integer Data Types | |
| |
| |
Floating-point Data Types | |
| |
| |
Character Data Type | |
| |
| |
Boolean Data Type | |
| |
| |
Casting Data Types | |
| |
| |
Variables | |
| |
| |
Declaring a Variable | |
| |
| |
Declaring Multiple Variables | |
| |
| |
Initializing a Variable | |
| |
| |
Scope of a Variable | |
| |
| |
The Life of a Variable | |
| |
| |
Quiz | |
| |
| |
| |
Expressions and Statements | |
| |
| |
Expressions | |
| |
| |
Types of Expressions | |
| |
| |
Operators | |
| |
| |
Arithmetic Operators | |
| |
| |
Relational Operators | |
| |
| |
Logical Operators | |
| |
| |
Bitwise Operators | |
| |
| |
Statements | |
| |
| |
Quiz | |
| |
| |
| |
Control Structures | |
| |
| |
Program Flow | |
| |
| |
Control Statements | |
| |
| |
Selection Statements | |
| |
| |
The if Statement | |
| |
| |
The switch Statement | |
| |
| |
Iteration Statements | |
| |
| |
The for Loop | |
| |
| |
The while Loop | |
| |
| |
The do while Loop | |
| |
| |
Jump Statements | |
| |
| |
break | |
| |
| |
continue | |
| |
| |
return | |
| |
| |
Quiz | |
| |
| |
| |
Arrays | |
| |
| |
Inside an Array | |
| |
| |
Allocating Memory for an Array | |
| |
| |
Initializing Arrays | |
| |
| |
Multidimensional Arrays | |
| |
| |
Creating a Multidimensional Array | |
| |
| |
Values Assigned to Array Elements | |
| |
| |
The Length Data Member | |
| |
| |
Passing an Array to a Method | |
| |
| |
Returning an Array from a Method | |
| |
| |
Alternate Ways of Creating an Array | |
| |
| |
The Arrays Class | |
| |
| |
equals () | |
| |
| |
fill () | |
| |
| |
sort () | |
| |
| |
binarySearch () | |
| |
| |
Quiz | |
| |
| |
| |
Methods and Polymorphism | |
| |
| |
An Inside Look at Methods | |
| |
| |
Types of Methods | |
| |
| |
The Method Definition | |
| |
| |
The Method Header | |
| |
| |
The Method Body | |
| |
| |
The Method Return Value | |
| |
| |
The Argument List | |
| |
| |
Elements of an Argument List | |
| |
| |
How an Argument List Works | |
| |
| |
Command-Line Arguments | |
| |
| |
Passing Command-Line Arguments | |
| |
| |
Calling a Method | |
| |
| |
Polymorphism | |
| |
| |
The Method Signature | |
| |
| |
Quiz | |
| |
| |
| |
Classes | |
| |
| |
Class Definition | |
| |
| |
Defining a Method Member | |
| |
| |
Access Specifiers | |
| |
| |
Declaring Instance Variables | |
| |
| |
Constructor | |
| |
| |
Declaring an Instance of a Class | |
| |
| |
Accessing Members of a Class | |
| |
| |
Overloading Member Methods | |
| |
| |
Overloading a Constructor | |
| |
| |
The this Keyword | |
| |
| |
Garbage Collection | |
| |
| |
The finalize () Method | |
| |
| |
Inner Classes | |
| |
| |
Static Initializers | |
| |
| |
Packages | |
| |
| |
Using a Package | |
| |
| |
Classpath | |
| |
| |
Packages and Access Protection | |
| |
| |
Quiz | |
| |
| |
| |
Inheritance | |
| |
| |
What Is Inheritance? | |
| |
| |
When to Use Inheritance | |
| |
| |
Inside Inherence | |
| |
| |
Accessing Members of an Inherited Class | |
| |
| |
The Superclass Can Be Instantiated | |
| |
| |
One-way Inheritance | |
| |
| |
Calling Constructors | |
| |
| |
Using the super Keyword | |
| |
| |
Multilevel Inheritance | |
| |
| |
Overriding Method Members Using Inheritance | |
| |
| |
Dynamic Method Dispatch | |
| |
| |
Abstract Classes | |
| |
| |
The final Keyword and Inheritance | |
| |
| |
The Object Class and Subclasses | |
| |
| |
Quiz | |
| |
| |
| |
Exception Handling | |
| |
| |
What Is an Exception? | |
| |
| |
Exception Handlers | |
| |
| |
Basic Exception Handling | |
| |
| |
Multiple Catch Blocks | |
| |
| |
The Finally Block | |
| |
| |
Working with Uncaught Exceptions | |
| |
| |
Nested Try Statements | |
| |
| |
Throwing an Exception | |
| |
| |
Methods That Don't Handle Exceptions | |
| |
| |
Checked and Unchecked Exceptions | |
| |
| |
Creating an Exception Subclass | |
| |
| |
Quiz | |
| |
| |
| |
Multithreading | |
| |
| |
Multitasking | |
| |
| |
Overhead | |
| |
| |
Threads | |
| |
| |
Synchronization | |
| |
| |
The Thread Classes and the Runnable Interface | |
| |
| |
The Main Thread | |
| |
| |
Creating Your Own Thread | |
| |
| |
Creating a Thread by Using extends | |
| |
| |
Using Multiple Threads in a Program | |
| |
| |
Using isAlive () and join () | |
| |
| |
Setting Thread Priorities | |
| |
| |
Synchronizing Threads | |
| |
| |
The Synchronized Method | |
| |
| |
Using the Synchronized Statement | |
| |
| |
Communicating Between Threads | |
| |
| |
Suspending and Resuming Threads | |
| |
| |
Quiz | |
| |
| |
| |
Files and Streams | |
| |
| |
Files and File Systems | |
| |
| |
The File Class | |
| |
| |
Listing Files Contained in a Directory | |
| |
| |
Streams | |
| |
| |
Writing to a File | |
| |
| |
Reading from a File | |
| |
| |
Appending to a File | |
| |
| |
Reading and Writing an Object to a File | |
| |
| |
Quiz | |
| |
| |
| |
Graphical User Interface | |
| |
| |
What Is a User Interface? | |
| |
| |
What Is a GUI? | |
| |
| |
A Simple GUI | |
| |
| |
swing | |
| |
| |
Content Container | |
| |
| |
Java Layout Managers | |
| |
| |
Push Buttons | |
| |
| |
Labels and Text Fields | |
| |
| |
Radio Buttons and Check Boxes | |
| |
| |
Combo Boxes | |
| |
| |
Text Area | |
| |
| |
Scroll Pane | |
| |
| |
Getting Data from GUI Components | |
| |
| |
Reading a Push Button | |
| |
| |
Reading Radio Buttons and Check Boxes | |
| |
| |
Reading a Combo Box | |
| |
| |
Disabling and Enabling GUI Elements | |
| |
| |
Quiz | |
| |
| |
| |
JDBC and Java Data Objects | |
| |
| |
Database 101 | |
| |
| |
The Concept of JDBC | |
| |
| |
JDBC Driver Types | |
| |
| |
JDBC API Packages | |
| |
| |
The JDBC Process | |
| |
| |
Load the JDBC Driver | |
| |
| |
Connect to the DBMS | |
| |
| |
Create and Execute an SQL Query | |
| |
| |
Terminate the Connection to the DBMS | |
| |
| |
Trapping Exceptions | |
| |
| |
Avoid Timing Out | |
| |
| |
More on Statement Objects | |
| |
| |
The Statement Object | |
| |
| |
The PreparedStatement Object | |
| |
| |
The CallableStatement Object | |
| |
| |
The ResultSet Object | |
| |
| |
Reading the Resultset | |
| |
| |
Positioning the Virtual Cursor | |
| |
| |
Fetching Rows | |
| |
| |
Updatable Resultset | |
| |
| |
Metadata | |
| |
| |
Data Types | |
| |
| |
Exceptions | |
| |
| |
Quiz | |
| |
| |
| |
Java Applets | |
| |
| |
Java Applet Basics | |
| |
| |
Writing a Java Applet | |
| |
| |
Structure of a Java Applet | |
| |
| |
Calling a Java Applet | |
| |
| |
Running a Java Applet | |
| |
| |
Other Attributes | |
| |
| |
Adding Graphics to the Applet Window | |
| |
| |
Passing Parameters | |
| |
| |
Restrictions | |
| |
| |
Using Dialog Boxes with an Applet | |
| |
| |
The Status Window | |
| |
| |
Quiz | |
| |
| |
Final Exam | |
| |
| |
Answers to Quizzes and Final Exam | |
| |
| |
Chapter 1 | |
| |
| |
Chapter 2 | |
| |
| |
Chapter 3 | |
| |
| |
Chapter 4 | |
| |
| |
Chapter 5 | |
| |
| |
Chapter 6 | |
| |
| |
Chapter 7 | |
| |
| |
Chapter 8 | |
| |
| |
Chapter 9 | |
| |
| |
Chapter 10 | |
| |
| |
Chapter 11 | |
| |
| |
Chapter 12 | |
| |
| |
Chapter 13 | |
| |
| |
Chapter 14 | |
| |
| |
Final Exam | |
| |
| |
Index | |