You are previewing The Java® Tutorial: A Short Course on the Basics, Fifth Edition.
O'Reilly logo
The Java® Tutorial: A Short Course on the Basics, Fifth Edition

Book Description

The Java®Tutorial, Fifth Edition, is based on Release 7 of the Java Platform Standard Edition. This revised and updated edition introduces the new features added to the platform, including a section on NIO.2, the new file I/O API, and information on migrating legacy code to the new API. The deployment coverage has also been expanded, with new chapters such as “Doing More with Rich Internet Applications” and “Deployment in Depth,” and a section on the fork/join feature has been added to the chapter on concurrency. Information reflecting Project Coin developments, including the new try-with-resources statement, the ability to catch more than one type of exception with a single exception handler, support for binary literals, and diamond syntax, which results in cleaner generics code, has been added where appropriate. The chapters covering generics, Java Web Start, and applets have also been updated. In addition, if you plan to take one of the Java SE 7 certification exams, this guide can help. A special appendix, “Preparing for Java Programming Language Certification,” lists the three exams available, details the items covered on each exam, and provides cross-references to where more information about each topic appears in the text. All of the material has been thoroughly reviewed by members of Oracle Java engineering to ensure that the information is accurate and up to date.

Table of Contents

  1. Title Page
  2. Copyright Page
  3. Contents
  4. Preface
    1. Who Should Read This Book?
    2. How to Use This Book
  5. About the Authors
  6. 1. Getting Started
    1. The Java Technology Phenomenon
    2. The “Hello World!” Application
    3. A Closer Look at the “Hello World!” Application
    4. Common Problems (and Their Solutions)
    5. Questions and Exercises: Getting Started
  7. 2. Object-Oriented Programming Concepts
    1. What Is an Object?
    2. What Is a Class?
    3. What Is Inheritance?
    4. What Is an Interface?
    5. What Is a Package?
    6. Questions and Exercises: Object-Oriented Programming Concepts
  8. 3. Language Basics
    1. Variables
    2. Operators
    3. Expressions, Statements, and Blocks
    4. Control Flow Statements
  9. 4. Classes and Objects
    1. Classes
    2. Objects
    3. More on Classes
    4. Nested Classes
    5. Enum Types
    6. Annotations
  10. 5. Interfaces and Inheritance
    1. Interfaces
    2. Inheritance
  11. 6. Generics
    1. Why Use Generics?
    2. Generic Types
    3. Generic Methods
    4. Bounded Type Parameters
    5. Generics, Inheritance, and Subtypes
    6. Type Inference
    7. Wildcards
    8. Type Erasure
    9. Restrictions on Generics
    10. Questions and Exercises: Generics
  12. 7. Packages
    1. Creating a Package
    2. Naming a Package
    3. Using Package Members
    4. Managing Source and Class Files
    5. Questions and Exercises: Creating and Using Packages
  13. 8. Numbers and Strings
    1. Numbers
    2. Characters
    3. Strings
  14. 9. Exceptions
    1. What Is an Exception?
    2. The Catch or Specify Requirement
    3. Catching and Handling Exceptions
    4. Specifying the Exceptions Thrown by a Method
    5. How to Throw Exceptions
    6. Unchecked Exceptions: The Controversy
    7. Advantages of Exceptions
    8. Summary of Exceptions
    9. Questions and Exercises: Exceptions
  15. 10. Basic I/O and NIO.2
    1. I/O Streams
    2. File I/O (Featuring NIO.2)
    3. Summary of Basic I/O and NIO.2
    4. Questions and Exercises: Basic I/O and NIO.2
  16. 11. Collections
    1. Introduction to Collections
    2. Interfaces
    3. Implementations
    4. Algorithms
    5. Custom Collection Implementations
    6. Interoperability
  17. 12. Concurrency
    1. Processes and Threads
    2. Thread Objects
    3. Synchronization
    4. Liveness
    5. Guarded Blocks
    6. Immutable Objects
    7. High-Level Concurrency Objects
    8. Questions and Exercises: Concurrency
  18. 13. Regular Expressions
    1. Introduction
    2. Test Harness
    3. String Literals
    4. Character Classes
    5. Predefined Character Classes
    6. Quantifiers
    7. Capturing Groups
    8. Boundary Matchers
    9. Methods of the Pattern Class
    10. Methods of the Matcher Class
    11. Methods of the PatternSyntaxException Class
    12. Unicode Support
    13. Additional Resources
    14. Questions and Exercises: Regular Expressions
  19. 14. The Platform Environment
    1. Configuration Utilities
    2. System Utilities
    4. Questions and Exercises: The Platform Environment
  20. 15. Packaging Programs in JAR Files
    1. Using JAR Files: The Basics
    2. Working with Manifest Files: The Basics
    3. Signing and Verifying JAR Files
    4. Using JAR-Related APIs
    5. Questions: Packaging Programs in JAR Files
  21. 16. Java Web Start
    1. Developing a Java Web Start Application
    2. Deploying a Java Web Start Application
    3. Displaying a Customized Loading Progress Indicator
    4. Running a Java Web Start Application
    5. Java Web Start and Security
    6. Common Java Web Start Problems
    7. Questions and Exercises: Java Web Start
  22. 17. Applets
    1. Getting Started with Applets
    2. Doing More with Applets
    3. Displaying a Customized Loading Progress Indicator
    4. Solving Common Applet Problems
    5. Questions and Exercises: Applets
  23. 18. Doing More with Java Rich Internet Applications
    1. Setting Trusted Arguments and Secure Properties
    2. JNLP API
    3. Cookies
    4. Customizing the Loading Experience
    5. Security in RIAs
    6. Questions and Exercises: Doing More with Java Rich Internet Applications
  24. 19. Deployment in Depth
    1. Deployment Toolkit
    2. Java Network Launch Protocol
    3. Deployment Best Practices
    4. Questions and Exercises: Deployment In Depth
  25. Appendix. Preparing for Java Programming Language Certification
    1. Programmer Level I Exam
    2. Programmer Level II Exam
    3. Java SE 7 Upgrade Exam
  26. Index
  27. Ad Pages