Home > Store

Sams Teach Yourself Java 2 in 21 Days, 3rd Edition

Register your product to gain access to bonus material or receive a coupon.

Sams Teach Yourself Java 2 in 21 Days, 3rd Edition

Premium Website

  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2003
  • Edition: 3rd
  • Premium Website
  • ISBN-10: 0-672-32370-2
  • ISBN-13: 978-0-672-32370-6

Sams Teach Yourself Java in 21 Days continues to be one of the most popular, best-selling Java tutorials on the market. Written by two expert technical writers, it has been acclaimed for its clear and personable writing, for its extensive use of examples, and for its logical and complete organization.

This new edition of the book maintains and improves upon all these qualities, while updating, revising, and reorganizing the material to cover the latest developments in Java and to expand the book¿s coverage of core Java programming topics.

Sun¿s new version of Java 2 Standard Edition¿SDK version 1.4¿is expected to be released by the end of 2001. According to Sun, version 1.4 builds upon Java¿s cross-platform support and security model with new features and functionality, enhanced performance and scalability, and improved reliability and serviceability.

Sample Content

Online Sample Chapters

Working with Objects

Working with Objects

Table of Contents

(NOTE: Each chapter concludes with a Summary, Q&A, Quiz and Exercises.)



Day 1. Getting Started with Java.

The Java Language. Object-Oriented Programming. Objects and Classes. Attributes and Behavior. Organizing Classes and Class Behavior.

Day 2. The ABCs of Programming.

Statements and Expressions. Variables and Data Types. Comments. Literals. Expressions and Operators. String Arithmetic.

Day 3. Working with Objects.

Creating New Objects. Accessing and Setting Class and Instance Variables. Calling Methods. References to Objects. Casting and Converting Objects and Primitive Types. Comparing Object Values and Classes.

Day 4. Lists, Logic, and Loops.

Arrays. Block Statements. if Conditionals. switch Conditionals. for Loops. while and do Loops. Breaking Out of Loops.

Day 5. Creating Classes and Methods.

Defining Classes. Creating Instance and Class Variables. Creating Methods. Creating Java Applications. Java Applications and Command-Line Arguments. Creating Methods with the Same Name, Different Arguments. Constructor Methods. Overriding Methods. Finalizer Methods.

Day 6. Packages, Interfaces, and Other Class Features.

Modifiers. Static Variables and Methods. Final Classes, Methods, and Variables. Abstract Classes and Methods. Packages. Using Packages. Creating Your Own Packages. Interfaces. Creating and Extending Interfaces. Inner Classes.

Day 7. Threads and Exceptions.

Exceptions. Managing Exceptions. Declaring Methods that Might Throw Exceptions. Creating and Throwing Your Own Exceptions. When to and When Not to Use Exceptions. Assertions. Threads.


Day 8. Data Structures and Strings.

Data Structures. Java Data Structures.

Day 9. Working with Swing.

Creating an Application. Working with Components.

Day 10. Building a Swing Interface.

Swing Features.

Day 11. Arranging Components on a User Interface.

Basic Interface Layout. Mixing Layout Managers. Card Layout. Grid Bag Layout. Cell Padding and Insets.

Day 12. Responding to User Input.

Event Listeners. Working with Methods.

Day 13. Color, Fonts, and Graphics.

The Graphics2D Class. Color. Drawing Lines and Polygons.

Day 14. Writing Java Applets.

How Applets and Applications Are Different. Applet Security Restrictions. Creating Applets. Including an Applet on a Web Page. Java Archives. Passing Parameters to Applets.


Day 15. Working with Input and Output.

Introduction to Streams. Byte Streams. Filtering a Stream. Character Streams. Files and Filename Filters.

Day 16. Serializing and Examining Objects.

Object Serialization. Inspecting Classes and Methods with Reflection. Remote Method Invocation.

Day 17. Communicating Across the Internet.

Networking in Java. The java.nio Package.

Day 18. JavaSound.

Retrieving and Using Sounds. JavaSound. MIDI Files.

Day 19. Creating and Using JavaBeans.

Reusable Software Components. Development Tools. Working with JavaBeans.

Day 20. Reading and Writing Data Using JDBC and XML.

Java Database Connectivity. Using XML. Processing XML with Java.

Day 21. Writing Java Servlets and JavaServer Pages.

Using Web Servlets. JavaServer Pages.


Appendix A. Choosing Java.

Java's Past, Present, and Future. Why Choose Java. Summary.

Appendix B. Using the Java 2 Software Development Kit.

Choosing a Java Development Tool. Configuring the Software Development Kit. Using a Text Editor. Creating a Sample Program.

Appendix C. Programming with the Java 2 Software Development Kit.

An Overview of the SDK. The java Interpreter. The javac Compiler. The appletviewer Browser. The javadoc Documentation Tool. The jar Java File Archival Tool. The jdb Debugger. Using System Properties. Summary. Q&A.

Appendix D. Using Sun ONE Studio.

Choosing a Java Development Tool. Configuring Sun ONE Studio. Creating a Sample Program.

Appendix E. Where to Go from Here: Java Resources.

Other Books to Consider. Sun's Official Java Site. Other Java Web Sites. Java Newsgroups. Job Opportunities.

Appendix F. This Book's Web Site.


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership