Synopses & Reviews
Version 5.0 of the Java 2 Standard Edition SDK is the most important upgrade since Java first appeared a decade ago. With Java 5.0, you'll not only find substantial changes in the platform, but to the language itself-something that developers of Java took five years to complete. The main goal of Java 5.0 is to make it easier for you to develop safe, powerful code, but none of these improvements makes Java any easier to learn, even if you've programmed with Java for years. And that means our bestselling hands-on tutorial takes on even greater significance.
Learning Java is the most widely sought introduction to the programming language that's changed the way we think about computing. Our updated third edition takes an objective, no-nonsense approach to the new features in Java 5.0, some of which are drastically different from the way things were done in any previous versions. The most essential change is the addition of "generics", a feature that allows developers to write, test, and deploy code once, and then reuse the code again and again for different data types. The beauty of generics is that more problems will be caught during development, and Learning Java will show you exactly how it's done.
Java 5.0 also adds more than 1,000 new classes to the Java library. That means 1,000 new things you can do without having to program it in yourself. That's a huge change. With our book's practical examples, you'll come up to speed quickly on this and other new features such as loops and threads. The new edition also includes an introduction to Eclipse, the open source IDE that is growing in popularity.
Learning Java, 3rd Edition addresses all of the important uses of Java, such as web applications, servlets, and XML that are increasingly driving enterprise applications.
About the Author
(firstname.lastname@example.org) became involved with Oak (Java's predecessor) while working at Southwestern Bell Technology Resources. He is an independent consultant and author in the areas of networking and distributed applications. Pat is the author of BeanShell, a popular Java scripting language, as well as various other free goodies on the Net. Most recently, Pat has been developing enterprise architecture for A.G. Edwards. He currently lives in the Central West End area of St. Louis with various creatures.
Jonathan Knudsen is an author at O'Reilly & Associates. His books include The Unofficial Guide to Lego Mindstorms Robots, Java 2D Graphics, and Java Cryptography. He is the Courseware Writer for LearningPatterns.com.
Table of Contents
Preface; New Developments; Using This Book; Online Resources; Conventions Used in This Book; Using Code Examples; Safari Enabled; How to Contact Us; Acknowledgments; Chapter 1: A Modern Language; 1.1 Enter Java; 1.2 A Virtual Machine; 1.3 Java Compared with Other Languages; 1.4 Safety of Design; 1.5 Safety of Implementation; 1.6 Application and User-Level Security; 1.7 Java and the Web; 1.8 Java as a General Application Language; 1.9 A Java Road Map; Chapter 2: A First Application; 2.1 Java Tools and Environment; 2.2 HelloJava; 2.3 HelloJava2: The Sequel; 2.4 HelloJava3: The Button Strikes!; 2.5 HelloJava4: Netscape's Revenge; 2.6 Troubleshooting; Chapter 3: Tools of the Trade; 3.1 The Java VM; 3.2 Running Java Applications; 3.3 The Classpath; 3.4 The Java Compiler; 3.5 JAR Files; 3.6 Policy Files; Chapter 4: The Java Language; 4.1 Text Encoding; 4.2 Comments; 4.3 Types; 4.4 Statements and Expressions; 4.5 Exceptions; 4.6 Assertions; 4.7 Arrays; Chapter 5: Objects in Java; 5.1 Classes; 5.2 Methods; 5.3 Object Creation; 5.4 Object Destruction; 5.5 Enumerations; Chapter 6: Relationships Among Classes; 6.1 Subclassing and Inheritance; 6.2 Interfaces; 6.3 Packages and Compilation Units; 6.4 Visibility of Variables and Methods; 6.5 Arrays and the Class Hierarchy; 6.6 Inner Classes; Chapter 7: Working with Objects and Classes; 7.1 The Object Class; 7.2 The Class Class; 7.3 Reflection; 7.4 Annotations; Chapter 8: Generics; 8.1 Containers: Building a Better Mousetrap; 8.2 Enter Generics; 8.3 "There Is No Spoon"; 8.4 Parameterized Type Relationships; 8.5 Casts; 8.6 Writing Generic Classes; 8.7 Bounds; 8.8 Wildcards; 8.9 Generic Methods; 8.10 Arrays of Parameterized Types; 8.11 Case Study: The Enum Class; 8.12 Case Study: The sort() Method; 8.13 Conclusion; Chapter 9: Threads; 9.1 Introducing Threads; 9.2 Threading an Applet; 9.3 Synchronization; 9.4 Scheduling and Priority; 9.5 Thread Groups; 9.6 Thread Performance; 9.7 Concurrency Utilities; 9.8 Conclusion; Chapter 10: Working with Text; 10.1 Text-Related APIs; 10.2 Strings; 10.3 Internationalization; 10.4 Parsing and Formatting Text; 10.5 Printf-Style Formatting; 10.6 Formatting with the java.text Package; 10.7 Regular Expressions; Chapter 11: Core Utilities; 11.1 Math Utilities; 11.2 Dates and Times; 11.3 Timers; 11.4 Collections; 11.5 Properties; 11.6 The Preferences API; 11.7 The Logging API; 11.8 Observers and Observables; Chapter 12: Input/Output Facilities; 12.1 Streams; 12.2 Files; 12.3 Serialization; 12.4 Data Compression; 12.5 The NIO Package; Chapter 13: Network Programming; 13.1 Sockets; 13.2 Datagram Sockets; 13.3 Simple Serialized Object Protocols; 13.4 Remote Method Invocation; 13.5 Scalable I/O with NIO; Chapter 14: Programming for the Web; 14.1 Uniform Resource Locators (URLs); 14.2 The URL Class; 14.3 Talking to Web Applications; 14.4 Web Services; Chapter 15: Web Applications and Web Services; 15.1 Web Application Technologies; 15.2 Web Applications; 15.3 WAR Files and Deployment; 15.4 Servlet Filters; 15.5 Building WAR Files with Ant; 15.6 Implementing Web Services; Chapter 16: Swing; 16.1 Components; 16.2 Events; 16.3 Event Summary; 16.4 The AWT Robot!; 16.5 Multithreading in Swing; Chapter 17: Using Swing Components; 17.1 Buttons and Labels; 17.3 Checkboxes and Radio Buttons; 17.4 Lists and Combo Boxes; 17.5 The Spinner; 17.6 Borders; 17.7 Menus; 17.8 Pop-up Menus; 17.10 The JScrollPane Class; 17.11 The JSplitPane Class; 17.12 The JTabbedPane Class; 17.13 Scrollbars and Sliders; 17.14 Dialogs; Chapter 18: More Swing Components; 18.1 Text Components; 18.2 Focus Navigation; 18.3 Tables; 18.4 Desktops; 18.5 Pluggable Look-and-Feel; 18.6 Creating Custom Components; Chapter 19: Layout Managers; 19.1 FlowLayout; 19.2 GridLayout; 19.3 BorderLayout; 19.4 BoxLayout; 19.5 CardLayout; 19.6 GridBagLayout; 19.7 Nonstandard Layout Managers; 19.8 Absolute Positioning; 19.9 SpringLayout; Chapter 20: Drawing with the 2D API; 20.1 The Big Picture; 20.2 The Rendering Pipeline; 20.3 A Quick Tour of Java 2D; 20.4 Filling Shapes; 20.5 Stroking Shape Outlines; 20.6 Using Fonts; 20.7 Displaying Images; 20.8 Drawing Techniques; 20.9 Printing; Chapter 21: Working with Images and Other Media; 21.1 Loading Images; 21.2 Producing Image Data; 21.3 Filtering Image Data; 21.4 Saving Image Data; 21.5 Simple Audio; 21.6 Java Media Framework; Chapter 22: JavaBeans; 22.1 What's a Bean?; 22.2 The NetBeans IDE; 22.3 Properties and Customizers; 22.4 Event Hookups and Adapters; 22.5 Binding Properties; 22.6 Building Beans; 22.7 Limitations of Visual Design; 22.8 Serialization Versus Code Generation; 22.9 Customizing with BeanInfo; 22.10 Hand-Coding with Beans; 22.11 BeanContext and BeanContextServices; 22.12 The Java Activation Framework; 22.13 Enterprise JavaBeans; Chapter 23: Applets; 23.1 The Politics of Applets; 23.2 The JApplet Class; 23.3 Using the Java Plug-in; 23.4 Java Web Start; 23.5 Using Digital Signatures; 23.6 Conclusion; Chapter 24: XML; 24.1 A Bit of Background; 24.2 XML Basics; 24.3 SAX; 24.4 DOM; 24.5 XPath; 24.6 XInclude; 24.7 Validating Documents; 24.8 JAXB and Code Generation; 24.9 Transforming Documents with XSL/XSLT; 24.10 Web Services; 24.11 The End of the Book; Appendix A: The Eclipse IDE; A.1 The IDE Wars; A.2 Getting Started with Eclipse; A.3 Using Eclipse; A.4 Eclipse Features; A.5 Conclusion; Appendix B: BeanShell: Simple Java Scripting; B.1 Running BeanShell; B.2 Java Statements and Expressions; B.3 BeanShell Commands; B.4 Scripted Methods and Objects; B.5 Changing the Classpath; B.6 Learning More . . .; Glossary; Colophon;