You are previewing Special Edition Using Java 2 Standard Edition.
O'Reilly logo
Special Edition Using Java 2 Standard Edition

Book Description

Special Edition Using Java 2 Standard Edition specifically covers only the Standard Edition of version 1.3 of the Java Software Development Kit (SDK). It begins with a series of quick refreshers for Object-oriented programming and Java fundamentals, including applet programming and threads, to ensure that readers are up to speed. The book then moves to intermediate Java features including user interface design with Java Foundation Classes (JFC) and Abstract Windows Toolkit (AWT), data structures and Java utilities, containers and layout managers, and creating images. Later chapters cover advanced topics including Internationalization & creating JAR archive files. Useful appendices offer further Java resources & SDK tool information. Throughout the book, the authors focus on Java 2 Standard Edition SDK version 1.3 changes, including the newest “HotSpot” compiler, which offers increased performance, faster start-up and smaller memory usage, among other improvements.

Table of Contents

  1. Copyright
  2. About the Authors
  3. Acknowledgments
  4. Introduction
  5. The Java Language
    1. Object-Oriented Programming
      1. Object-Oriented Programming: A Different Way of Thinking
      2. A Short History of Programming
      3. A Lesson in Objects
      4. Objects as Multiple Entities
      5. Modularity and Code Organization
      6. Relating Objects to Java Classes
      7. Building a Hierarchy: Steps in OOP Design
      8. OOP and the UML
      9. Is Java a Magic OOP Bullet?
    2. HelloWorld: Your First Java Program
      1. HelloWorld Application
      2. Understanding HelloWorld
      3. HelloWorld as an Applet
      4. Keywords
      5. The Java 1.3 API
      6. Troubleshooting
    3. Data Types and Other Tokens
      1. Java Data Types
      2. Working with Variables
      3. The boolean Primitive
      4. The Flavors of Integer
      5. Operators
      6. Character Variables
      7. Floating-Point Variables
      8. Literals: Assigning Values
      9. Integer Literals
      10. Character Literals
      11. Floating-Point Literals
      12. String Literals
      13. Arrays
      14. Non-Token Input Elements
      15. Troubleshooting
    4. Methods and Exceptions
      1. Declaring a Method
      2. Blocks and Statements
      3. Methods and the UML Sequence Diagram
      4. Catching and Throwing Exceptions
      5. Java's Error Classes
      6. Troubleshooting
    5. Using Expressions
      1. What Is an Expression?
      2. How Expressions Are Evaluated
      3. Of Special Interest to C Programmers
      4. Bitwise Operators
      5. Shift Operators
      6. Type Conversions
      7. Special Operator Support for Strings
      8. Troubleshooting
    6. Control Flow
      1. Controlling the Flow of Execution
      2. Boolean Operators
      3. Logical Expressions
      4. The Conditional Operator
      5. Booleans in Control Flow Statements
      6. Control Flow Functions
      7. switch Statements
      8. Iteration Statements
      9. Jump Statements
      10. Troubleshooting
    7. Classes
      1. What Are Classes?
      2. Why Use Classes?
      3. Classes in Java
      4. Declaring a Class
      5. Variables—Defining State
      6. Methods—Defining Behavior
      7. Creating an Instance of a Class
      8. Referring to Class Elements
      9. The Object Class
      10. Casting and Converting Reference Types
      11. Inner Classes
      12. Packages
      13. Wrapping the Primitive Types in Classes
      14. Using the Standard Mathematical Functions
      15. Building a UML Class Diagram
      16. Troubleshooting
    8. Using Strings and Text
      1. Introducing Strings
      2. Using the String Class
      3. Getting Information About a String Object
      4. Comparing Strings
      5. String Extraction
      6. String Manipulation
      7. Concatenating Strings
      8. Converting Objects to Strings
      9. Converting Primitives to Strings
      10. Using the StringBuffer Class
      11. Using the StringTokenizer Class
      12. Strings and the Compiler
      13. Troubleshooting
    9. Interfaces
      1. What Are Interfaces?
      2. Defining an Interface
      3. Implementing an Interface
      4. Referencing Interfaces
      5. Choosing Between an Interface and an Abstract Class
      6. Depicting Interfaces in UML
      7. Troubleshooting
    10. Data Structures and Java Utilities
      1. Collection and Utility Classes
      2. The Collections Framework
      3. Collection Interfaces
      4. In the Beginning
      5. General-Purpose Implementations
      6. Sorting a Collection
      7. Iterating a Collection
      8. Collection Utilities and Wrappers
      9. Which Collection Class to Use?
      10. Array Utilities
      11. Configuring an Application Using the Properties Class
      12. Working with Dates
      13. The BitSet Class
      14. Generating Random Numbers
      15. Monitoring State Changes Using Observer/Observable
      16. Troubleshooting
    11. Threads
      1. What Are Threads?
      2. Why Use Threads?
      3. How to Make Your Classes Threadable
      4. Extending Thread
      5. Implementing Runnable
      6. The Life Cycle of a Thread
      7. Using Thread Local Variables
      8. Changing Thread Priorities
      9. Thread Synchronization
      10. Changing the Running State of a Thread
      11. Thread Groups
      12. Obtaining the Number of Running Threads
      13. Yielding to Other Threads
      14. Daemon Threads
      15. Using the Timer and TimerTask Classes
      16. Making Your Application Thread-Safe
      17. Troubleshooting
  6. User Interface
    1. Introduction to Java Foundation Classes
      1. What Is the JFC?
      2. History of the JFC
      3. JFC Applications
      4. Applets
      5. Troubleshooting
      6. Playing Audio Clips from a JFC Application
      7. Launching a Frame from an Applet
    2. Beginning AWT
      1. What Is the AWT?
      2. Graphics
      3. Fonts and Colors
      4. Images
      5. Troubleshooting
    3. Building a GUI: AWT Style
      1. Introducing the Windowing Toolkit
      2. Building a GUI: Components, Containers, and Layout Managers
      3. Building a GUI: Events and Listeners
      4. Customizing the Windowing Toolkit
      5. Troubleshooting
    4. And Then There Was Swing
      1. What Is Swing?
      2. Comparing Swing to the AWT
      3. Mixing Heavyweight and Lightweight Components
      4. Converting from the AWT to Swing
      5. Troubleshooting
    5. Building a GUI: Swing Style
      1. A Swinging Toolkit
      2. Building a GUI: Components, Containers, and Layout Managers
      3. Building a GUI: Events and Listeners
      4. Odds and Ends
      5. Troubleshooting
    6. Accessibility
      1. What Is Accessibility?
      2. How Does Accessibility Work?
      3. Utilities
      4. Robots
      5. Troubleshooting
    7. Java 2D
      1. What Is Java 2D?
      2. Rendering 101
      3. Shapes, Text, and Buffered Images
      4. Printing
      5. Troubleshooting
    8. Drag and Drop
      1. What Is Drag and Drop?
      2. First Comes Data Transfer
      3. Then Comes Drag and Drop
      4. Troubleshooting
    9. Java Media Framework
      1. What Is JMF?
      2. Playing Media
      3. Processing Media
      4. Capturing Media
      5. Troubleshooting
  7. I/O
    1. Streams, Files, and Serialization
      1. What Are Streams?
      2. Working with the Stream Classes
      3. Reading and Writing Data Using Byte Streams
      4. Redirecting Standard Input/Output
      5. Using Readers and Writers
      6. Working with Files
      7. Creating Files
      8. Reading and Writing Files
      9. Directory Operations
      10. Object Streams
      11. Troubleshooting
    2. Object Serialization
      1. What Is Object Serialization?
      2. Object Serialization Example
      3. Reading and Writing Your Own Objects
      4. Customizing Object Serialization
      5. Using the Externalizable Interface
      6. Troubleshooting
    3. Communications and Networking
      1. Overview of Network Communications
      2. TCP/IP Architecture
      3. Working with Sockets
      4. Compressing Data When Using Sockets
      5. Sending Objects Across the Network Using Sockets
      6. Obtaining Hostname and IP Address Information
      7. User Datagram Protocol (UDP)
      8. World Wide Web Overview
      9. Understanding the Request/Response Scenario
      10. Using the URL Classes
      11. An Example: Building a World Wide Web Graph
      12. HTTP and SSL
      13. Java Secure Socket Extension Package Overview
      14. Troubleshooting
    4. Using Internationalization
      1. What Is Internationalization?
      2. Java Support for Internationalization
      3. The Locale Class
      4. Packaging Locale-Sensitive Data
      5. Calendar and Time Zone Support
      6. Internationalization Formatting
      7. Character Set Converters
      8. Readers and Writers
      9. The java.text Package
      10. An Example: InternationalizationTest
      11. Troubleshooting
    5. JAR Files
      1. Using JAR Files
      2. Some Differences Between ZIP and JAR Formats
      3. Creating and Viewing a JAR
      4. The Manifest File
      5. Reading and Writing JAR Files
      6. Adding a JAR to Your Classpath
      7. JARs and Security
      8. When to Use JARs
      9. Troubleshooting
  8. Databases
    1. JDBC 2.0 Fundamentals
      1. What Is the JDBC?
      2. JDBC 2.0 Overview
      3. JDBC Drivers
      4. Setting Up a Database
      5. Installing and Using a JDBC Driver
      6. JDBC URLs
      7. Connecting to the Database
      8. Reading Data Using JDBC
      9. Writing Data Using JDBC
      10. Using Prepared Statements
      11. Using Transactions
      12. Getting MetaData from the Database
      13. Using Stored Procedures
      14. Troubleshooting
    2. Advanced JDBC 2.0
      1. New Features in JDBC 2.0 API
      2. Using the JDBC Optional Package
      3. Understanding Object-to-Relational Mapping Frameworks
      4. Troubleshooting
  9. Component Development
    1. Reflection
      1. What Is Reflection?
      2. Key Classes of the Reflection API
      3. Security Considerations
      4. Creating a Class Knowing Only the List of Constructors
      5. Inspecting a Class for Its Methods
      6. Accessing the Declared Fields of a Class
      7. Utility Methods
      8. Implementing an Interface Using a Proxy
      9. Troubleshooting
    2. JavaBeans
      1. Self-Contained Components
      2. Important Concepts in Component Models
      3. The Basics of Designing a JavaBean
      4. Creating and Using Properties
      5. Using Events to Communicate with Other Components
      6. Introspection: Creating and Using BeanInfo Classes
      7. Customization: Providing Custom PropertyEditors and GUI Interfaces
      8. Bean Packaging
      9. Enterprise JavaBeans
      10. Troubleshooting
  10. Installing the SDK and Getting Started
    1. Getting the SDK 1.3SE
    2. Installing the SDK 1.3SE
    3. Testing the Java Compiler and JVM
  11. SDK Tools
    1. SDK Tools Reference
    2. AppletViewer
    3. java—The Java Interpreter
    4. javac—The Java Compiler
    5. javap—The Java Disassembler
    6. The javadoc Tool (Documentation Generator)
    7. jdb—The Java Debugger
  12. SDK 1.3 Performance Improvements
    1. General Performance Improvements
    2. Introduction to HotSpot Technology
    3. What Makes HotSpot Better?
    4. Java HotSpot Client Virtual Machine
    5. Java HotSpot Server Virtual Machine 2.0
    6. Applet Deployment Improvements
  13. Java Resources
    1. Web Sites
    2. Newsgroups
    3. Mailing Lists
  14. Index