内容简介
CHAPTER 1 Getting Started
About the Java Technology
How Will Java Technology Change My Life?
First Steps(Win32)
First Steps(UNIX/Linux)
First Steps(MacOS)
A Closer Look at HelloWorld
Questions and Exercises
Code Samples
CHAPTER 2 Object-Oriented Programming Concepts
What Is an Object?
What Is a Message?
What Is aClass?
What Is Inheritance?
What Is anInterface?
How Do These Concepts Translate into Code?
Summary
Questions and Exercises
Code Samples
CHAPTER 3 Language Basics
Variables
Operators
Expressions,Statements,and Blocks
Control Flow Statements
Code Samples
CHAPTER 4 Object Basics and Simple Data Objects
The Life Cycle ofan Object
Characters and Strings
Numbers
Arrays
Code Samples
CHAPTER 5 Classes and Inheritance
Creating Classes
Managing Inheritance
Implementing Nested Classes
Code Samples
CHAPTER 6 Interfaces and Packages
Creating and Using Interfaces
Creating and Using Packages
Code Samples
CHAPTER 7 Handling Errors Using Exceptions
What Is an Exception?
The Catch or Specify Requirement
Catching and Handling Exceptions
Specifying the Exceptions Thrown by a Method
How to Throw Exceptions
Runtime Exceptions—The Controversy
Advantages of Exceptions
Summary of Exceptions
Questions and Exercises
Code Samples
CHAPTER 8 Threads:Doing Two or More Tasks at Once
What Is a Thread?
Using the Timer and TimerTask Classes
Customizing a Thread's run Method
The Life Cycle ofa Thread
Understanding Thread Priority
Synchronizing Threads
Grouping Threads
Summary of Threads
Questions and Exercises
Code Samples
CHAPTER 9 I/O:Reading and Writing
Overview of I/O Streams
Using the Streams
Object Serialization
Working with Random Access Files
And the Rest...
Summary of Reading and Writing
Questions and Exercises
Code Samples
CHAPTER 10 User Interfaces That Swing
Overview of the Swing API
Your First Swing Program
Example Two:Swing Application
Example Three:Celsius Converter
Example Four:LunarPhases
Example Five:VoteDialog
Layout Management
Threads and Swing
Visual Index to Swing Components
Summary
Questions and Exercises
Code Samples
APPENDIX A Common Problems and Their Solutions
Getting Started Problems
General Programming Problems
Applet Problems
User Interface Problems
APPENDIX B Internet-Ready Applets
Overview of Applets
AWT Components
Taking Advantage of the Applet API
Practical Considerations of Writing Applets
Finishing an Applet
Swing-Based Applets
Code Samples
APPENDIX C Collections
Introduction
Interfaces
Implementations
Algorithms
Custom Implementations
Interoperability
APPENDIX D Deprecated Thread Methods
Why Is Th read.stop Deprecated?
Why Are Thread.suspend and Thread.resume Deprecated?
What about Thread.destroy?
Whv Is Runti me.runFi nalizersOnExit Deprecated?
APPENDIX E Reference
Java Programming Language Keywords
Operator Precedence
The <APPLET>Tag
POSIX Conventions for Command Line Arguments
Integrated Development Environments
Path Help
Index