You are previewing Sams Teach Yourself Java 2 in 21 Days, Second Edition.
O'Reilly logo
Sams Teach Yourself Java 2 in 21 Days, Second Edition

Book Description

Sams Teach Yourself Java in 21 Days, Second Edition is known for its clear and personable writing, its extensive use of examples, and its logical step-by-step organization. This new edition maintains and improves upon all these qualities, while updating and revising the material to cover the latest developments in Java and the way the language is used today.

Table of Contents

  1. Copyright
  2. About the Authors
  3. Acknowledgments
  4. Tell Us What You Think!
  5. Introduction
  6. Java's Fundamental Concepts
    1. 21st Century Java
      1. Exploring Java 2
      2. Why to Choose Java
      3. Diving into Java Programming
      4. Your First Java Program
      5. Summary
      6. Q&A
      7. Quiz
      8. Exercises
    2. Object-Oriented Programming
      1. Thinking in Terms of Objects
      2. Objects and Classes
      3. Attributes and Behavior
      4. Organizing Classes and Class Behavior
      5. Summary
      6. Q&A
      7. Quiz
      8. Exercises
    3. The ABCs of Java
      1. Statements and Expressions
      2. Variables and Data Types
      3. Comments
      4. Literals
      5. Expressions and Operators
      6. String Arithmetic
      7. Summary
      8. Q&A
      9. Quiz
      10. Exercises
    4. Working with Objects
      1. Creating New Objects
      2. Accessing and Setting Class and Instance Variables
      3. Calling Methods
      4. References to Objects
      5. Casting and Converting Objects and Primitive Types
      6. Comparing Object Values and Classes
      7. Summary
      8. Q&A
      9. Quiz
      10. Exercises
    5. Lists, Logic, and Loops
      1. Arrays
      2. Block Statements
      3. if Conditionals
      4. switch Conditionals
      5. for Loops
      6. while and do Loops
      7. Breaking Out of Loops
      8. Summary
      9. Q&A
      10. Quiz
      11. Exercises
    6. Creating Classes and Methods
      1. Defining Classes
      2. Creating Instance and Class Variables
      3. Creating Methods
      4. Creating Java Applications
      5. Java Applications and Command-Line Arguments
      6. Creating Methods with the Same Name, Different Arguments
      7. Constructor Methods
      8. Overriding Methods
      9. Finalizer Methods
      10. Summary
      11. Q&A
      12. Quiz
      13. Exercises
    7. Writing Java Applets
      1. How Applets and Applications Are Different
      2. Applet Security Restrictions
      3. Creating Applets
      4. Including an Applet on a Web Page
      5. More About the <APPLET> Tag
      6. Java Archives
      7. Passing Parameters to Applets
      8. Developing Java 2 Applets
      9. Summary
      10. Q&A
      11. Exercises
  7. Swing and Other Visual Java Programming
    1. Working with Swing
      1. Creating an Application
      2. Working with Components
      3. Summary
      4. Q&A
      5. Exercises
    2. Building a Swing Interface
      1. Swing Features
      2. Summary
      3. Q&A
      4. Exercises
    3. Arranging Components on a User Interface
      1. Basic Interface Layout
      2. Mixing Layout Managers
      3. Card Layout
      4. Grid Bag Layout
      5. Cell Padding and Insets
      6. Summary
      7. Q&A
      8. Exercises
    4. Responding to User Input
      1. Event Listeners
      2. Working with Methods
      3. Summary
      4. Q&A
      5. Exercises
    5. Color, Fonts, and Graphics
      1. Graphics Classes
      2. Creating a Drawing Surface
      3. Drawing and Filling
      4. Text and Fonts
      5. Color
      6. Advanced Graphics Operations Using Java2D
      7. Summary
      8. Q&A
      9. Exercises
    6. Threads and Animation
      1. Creating Animation in Java
      2. Retrieving and Using Images
      3. Creating Animation Using Images
      4. Summary
      5. Q&A
      6. Exercises
    7. JavaSound
      1. Retrieving and Using Sounds
      2. JavaSound
      3. Summary
      4. Q&A
      5. Exercises
  8. Java's Advanced Features
    1. Packages, Interfaces, and Other Class Features
      1. Modifiers
      2. Static Variables and Methods
      3. Final Classes, Methods, and Variables
      4. Abstract Classes and Methods
      5. Packages
      6. Using Packages
      7. Creating Your Own Packages
      8. Interfaces
      9. Creating and Extending Interfaces
      10. Inner Classes
      11. Summary
      12. Q&A
      13. Exercises
    2. Error Handling and Security
      1. Exceptions, the Old and Confusing Way
      2. Java Exceptions
      3. Managing Exceptions
      4. Declaring Methods That Might Throw Exceptions
      5. Creating and Throwing Your Own Exceptions
      6. When and When Not to Use Exceptions
      7. Using Digital Signatures to Identify Applets
      8. Summary
      9. Q&A
      10. Exercises
    3. Handling Data Through Java Streams
      1. Introduction to Streams
      2. Byte Streams
      3. Filtering a Stream
      4. Character Streams
      5. Files and Filename Filters
      6. Summary
      7. Q&A
      8. Exercises
    4. Object Serialization and Reflection
      1. Object Serialization
      2. Inspecting Classes and Methods with Reflection
      3. Remote Method Invocation
      4. Summary
      5. Q&A
      6. Exercises
    5. Communicating Across the Internet
      1. Networking in Java
      2. Summary
      3. Q&A
      4. Exercises
    6. Working with JavaBeans
      1. Reusable Software Components
      2. Development Tools
      3. Working with JavaBeans
      4. Summary
      5. Q&A
      6. Exercises
    7. Java Database Connectivity and Data Structures
      1. Java Database Connectivity
      2. Data Structures
      3. Java Data Structures
      4. Summary
      5. Q&A
      6. Exercises
    8. Configuring the Software Development Kit
      1. Using a Command-Line Interface
      2. Configuring the Software Development Kit
      3. UNIX Configuration
    9. Using a Text Editor with the Software Development Kit
      1. Choosing a Text Editor
      2. Creating a File Association in Windows
    10. The Software Development Kit
      1. An Overview of the SDK
      2. The java Interpreter
      3. The javac Compiler
      4. The appletviewer Browser
      5. The javadoc Documentation Tool
      6. The jdb Debugger
      7. Using System Properties
      8. Summary
      9. Q&A
  9. Index