Book description
The author of the best-selling Java in a Nutshell has created an entire book of real-world Java programming examples that you can learn from. If you learn best "by example," this is the book for you.This third edition covers Java 1.4 and contains 193 complete, practical examples: over 21,900 lines of densely commented, professionally written Java code, covering 20 distinct client-side and server-side APIs. It includes new chapters on the Java Sound API and the New I/O API. The chapters on XML and servlets have been rewritten to cover the latest versions of the specifications and to demonstrate best practices for Java 1.4. New and updated examples throughout the book demonstrate many other new Java features and APIs.Java Examples in a Nutshell is a companion volume to Java in a Nutshell, Java Foundation Classes in a Nutshell, and Java Enterprise in a Nutshell. It picks up where those quick references leave off, providing a wealth of examples for both novices and experts. This book doesn't hold your hand; it simply delivers well-commented working examples with succinct explanations to help you learn and explore Java and its APIs.Java Examples in a Nutshell contains examples that demonstrate:
- Core APIs, including I/O, New I/O, threads, networking, security, serialization, and reflection
- Desktop APIs, highlighting Swing GUIs, Java 2D graphics, preferences, printing, drag-and-drop, JavaBeans, applets, and sound
- Enterprise APIs, including JDBC (database access), JAXP (XML parsing and transformation), Servlets 2.4, JSP 2.0 (JavaServer Pages), and RMI
Publisher resources
Table of contents
- Java Examples in a Nutshell, 3rd Edition
- A Note Regarding Supplemental Files
- Preface
-
I. Learning Java
-
1. Java Basics
- 1.1. Hello World
- 1.2. FizzBuzz
- 1.3. The Fibonacci Series
- 1.4. Using Command-Line Arguments
- 1.5. Echo in Reverse
- 1.6. FizzBuzz Switched
- 1.7. Computing Factorials
- 1.8. Recursive Factorials
- 1.9. Caching Factorials
- 1.10. Computing Big Factorials
- 1.11. Handling Exceptions
- 1.12. Interactive Input
- 1.13. Using a StringBuffer
- 1.14. Sorting Numbers
- 1.15. Computing Primes
- 1.16. Exercises
- 2. Objects, Classes, and Interfaces
-
1. Java Basics
-
II. Core Java APIs
-
3. Input/Output
- 3.1. Files and Streams
- 3.2. Working with Files
- 3.3. Copying File Contents
- 3.4. Reading and Displaying Text Files
- 3.5. Listing Directory and File Information
- 3.6. Compressing Files and Directories
- 3.7. Filtering Character Streams
- 3.8. Tokenizing a Character Stream
- 3.9. Random Access to Files
- 3.10. Exercises
- 4. Threads
-
5. Networking
- 5.1. Downloading the Contents of a URL
- 5.2. Using a URLConnection
- 5.3. Sending Email Through a URLConnection
- 5.4. A Simple Network Client
- 5.5. A Generic Client
- 5.6. An HTTP Client
- 5.7. A POP Client
- 5.8. A Simple Web Server
- 5.9. A Proxy Server
- 5.10. A Generic Multithreaded Server
- 5.11. Sending Datagrams
- 5.12. Receiving Datagrams
- 5.13. Exercises
-
6. New I/O
- 6.1. Locking Files
- 6.2. Copying Files
- 6.3. Regular Expressions and Character Decoding
- 6.4. File Copying with Buffers
- 6.5. Advanced Byte-to-Character Conversion
- 6.6. Tokenizing Byte Buffers
- 6.7. A Simple HTTP Client
- 6.8. The Daytime Service
- 6.9. A Multiplexed Server
- 6.10. A Multiplexed Network Client
- 6.11. Exercises
- 7. Security and Cryptography
- 8. Internationalization
- 9. Reflection
- 10. Object Serialization
-
3. Input/Output
-
III. Desktop Java APIs
-
11. Graphical User Interfaces
- 11.1. Components
- 11.2. Containers
- 11.3. Layout Management
- 11.4. Event Handling
- 11.5. A Complete GUI
- 11.6. Actions and Reflection
- 11.7. Custom Dialogs
- 11.8. An Error Handler Dialog
- 11.9. Displaying Tables
- 11.10. Displaying Trees
- 11.11. A Simple Web Browser
- 11.12. Describing GUIs with Properties
- 11.13. Themes and the Metal Look-and-Feel
- 11.14. Look-and-Feel Preferences
- 11.15. The ShowBean Program
- 11.16. Exercises
-
12. Graphics
- 12.1. Graphics Before Java 1.2
- 12.2. The Java 2D API
- 12.3. Drawing and Filling Shapes
- 12.4. Transforms
- 12.5. Line Styles with BasicStroke
- 12.6. Stroking Lines
- 12.7. Filling Shapes with Paint
- 12.8. Antialiasing
- 12.9. Combining Colors with AlphaComposite
- 12.10. Image Processing
- 12.11. Image I/O
- 12.12. Custom Shapes
- 12.13. Custom Strokes
- 12.14. Custom Paint
- 12.15. Advanced Animation
- 12.16. Displaying Graphics Examples
- 12.17. Exercises
- 13. Printing
- 14. Data Transfer
- 15. JavaBeans
- 16. Applets
- 17. Sound
-
11. Graphical User Interfaces
-
IV. Enterprise Java APIs
- 18. Database Access with SQL
- 19. XML
-
20. Servlets and JavaServer Pages
- 20.1. Servlet Setup
- 20.2. A Hello World Servlet
- 20.3. Another Simple Servlet
- 20.4. Servlet Initialization and Persistence: A Counter Servlet
- 20.5. Hello JSP
- 20.6. Hello JSP2
- 20.7. Hello XML
- 20.8. The MVC Paradigm for Web Applications
- 20.9. ListManager Model Classes
- 20.10. ListManager Controller
- 20.11. ListManager Views
- 20.12. Custom Tags in JSP 2.0
- 20.13. Packaging a Web Application
- 20.14. Exercises
- 21. Remote Method Invocation
- 22. Example Index
- Index
- About the Author
- Colophon
- Copyright
Product information
- Title: Java Examples in a Nutshell, 3rd Edition
- Author(s):
- Release date: January 2004
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9780596006204
You might also like
book
Java in a Nutshell, 6th Edition
The latest edition of Java in a Nutshell is designed to help experienced Java programmers get …
book
Java Projects - Second Edition
Learn how to build scalable, resilient, and effective applications in Java that suit your software requirements. …
book
Killer Game Programming in Java
Although the number of commercial Java games is still small compared to those written in C …
book
Java Cookbook, 4th Edition
Java continues to grow and evolve, and this cookbook continues to evolve in tandem. With this …