Home > Store

Java How to Program, 3rd Edition

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

Java How to Program, 3rd Edition


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



  • NEW - Updated to Java 2.
  • NEW - Replaces the current AWT graphical user interface components with the new Swing Set GUI components—Presents the most current graphical techniques for Java programming.
  • NEW - Stronger emphasis on applications rather than applets.
  • NEW - Thorough Revision of the first 3 chapters to emphasize problem solving and programming skills.
    • Helps to build a stronger foundation in programming skills.

    • Less rigorous and demanding introductory chapters than in previous editions so that students are not overwhelmed.

  • NEW - New Chapter: Java Database Connectivity.
  • NEW - New Chapter: Servlets.
  • NEW - New Chapter: JavaBeans.
  • NEW - New Chapter: Remote Method Invocation.
  • NEW - New Chapter: Collections.
  • NEW - Uses new 2D graphics API in Chapter 9 (Graphics) and uses new Media APIs in Chapter 14 (Multimedia).

CD with each book includes: Sun Java2SDK, standard edition v.12.1; Borland JBuilder3 University Edition; Source code for all the book's examples; and hyperlinks to Java demos and Internet resources.

  • “Live Code” examples—Teaches concepts through extensive working programs that illustrate the ideas being discussed.
  • Introduces Java at an introductory programming level— Covering good programming practices, syntax, and object-oriented techniques.
  • Detailed coverage of object-based programming.
    • Shows students how to use Java to access members and classes, initialize class objects, understand data abstraction, and more.

  • Excellent Pedagogy—Icons throughout the text identify good programming practices, common errors to avoid, portability tips, and basic software engineering performance concepts.
  • Extensive, realistic problem sets.
    • Allows students to apply what they've learned in each chapter.

  • An extensive set of supporting resources—Includes an extensive Instructor's Manual; a Test Bank; access to the authors via e-mail [deitel@deitel. com]; and a companion website that offers additional instructor and student support (includes Adobe Acrobat PDF slides for electronic display at www.prenhall.com/deitel).
  • Java How to Program, Third Edition, is also available packaged with the award-winning interactive Multimedia Cyber Classroom CD-ROM in in The Complete Java Training Course (BK/ Cyber Classroom CD-ROM, 0-13-085248-1). For more information see page ____.


  • Copyright 2000
  • Dimensions: 7" x 9-1/4"
  • Pages: 1355
  • Edition: 3rd
  • Book
  • ISBN-10: 0-13-012507-5
  • ISBN-13: 978-0-13-012507-1

Java is revolutionizing software development with multimedia-intensive, platform-independent, object-oriented code for conventional, Internet-, Intranet- and Extranet-based applets and application. This Third Edition of the world's most widely used university-level Java textbook includes on CD two complete Java Integrated Development Environment (IDEs).

In Java How to Program: Third Edition, the Deitels introduce the fundamentals of object-oriented programming and client/server development in Java. Key topics include:

  • Swing GUI, JavaBeans, event handling, graphics
  • Distributed computing: Servlets, RMI, networking
  • Database (JDBC), data structures, collections, files
  • Multimedia, animation, audio
  • Internet, World Wide Web
  • Multithreading, exceptions

Java How to Program: Third Edition includes:

  • Hundreds of "live-code" programs with screen captures that show exact outputs
  • Extensive exercises (many with answers) accompanying every chapter
  • Hundreds of tips, recommended practices and cautions-all marked with icons

Java How to Program is the centerpiece of a family of resources for teaching and learning Java, including a Web site (http://www.prenhall.com/deitel) with the book's code examples and other information for faculty, students and professional programmers; an optional interactive CD-ROM (Java Multimedia Cyber Classroom) containing extensive interactivity features— such as thousands of hyperlinks and audio walkthroughs of the code examples in Java How to Program— and e-mail access to the authors at

Sample Content

Table of Contents

1. Introduction to Computers, the Internet and the Web

Introduction. What Is a Computer? Computer Organization. Evolution of Operating Systems. Personal, Distributed and Client/Server Computing. Machine Languages, Assembly Languages and High-Level Languages. History of C++. History of Java. Java Class Libraries. Other High-level Languages. Structured Programming. The Internet and the World Wide Web. Basics of a Typical Java Environment. General Notes about Java and This Book. A Tour of the Book.

2. Introduction to Java Applications.

Introduction. A Simple Program: Printing a Line of Text. Another Java Application: Adding Integers. Memory Concepts. Arithmetic. Decision Making: Equality and Relational Operators.

3. Introduction to Java Applets.

Introduction. Thinking About Objects. Sample Applets from the Java 2 Software Development Kit. A Simple Java Applet: Drawing a String. Two More Simple Applets: Drawing Strings and Lines. Another Java Applet: Adding Integers. Java Applet Internet and World Wide Web Resources.

4. Control Structures: Part 1.

Introduction. Algorithms. Pseudocode. Control Structures. The if Selection Structure. The if/else Selection Structure. The While Repetition Structure. Formulating Algorithms: Case Study 1 (Counter-Controlled Repetition). Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 2 (Sentinel-Controlled Repetition). Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 3 (Nested Control Structures). Assignment Operators. Increment and Decrement Operators. Primitive Data Types.

5. Control Structures: Part 2.

Introduction. Essentials of Counter-Controlled Repetition. The for Repetition Structure. Examples Using the for Structure. The switch Multiple-Selection Structure. The Do/While Repetition Structure. The break and continue Statements. The Labeled break and continue Statements. Logical Operators. Structured Programming Summary.

6. Methods.

Introduction. Program Modules in Java. Math Class Methods. Methods. Method Definitions. Java API Packages. Random Number Generation. Example: A Game of Chance. Duration of Identifiers. Scope Rules. Recursion. Example Using Recursion: The Fibonacci Series. Recursion vs. Iteration. Method Overloading. Methods of Class JApplet.

7. Arrays.

Introduction. Arrays. Declaring and Allocating Arrays. Examples Using Arrays. References and Reference Parameters. Passing Arrays to Methods. Sorting Arrays. Searching Arrays: Linear Search and Binary Search. Multiple-Subscripted Arrays.

8. Object-Based Programming.

Introduction. Implementing a Time Abstract Data Type with a Class. Class Scope. Controlling Access to Members. Creating Packages. Initializing Class Objects: Constructors. Using Overloaded Constructors. Using Set and Get Methods. Software Reusability. Final Instance Variables. Composition: Objects as Instance Variables of Other Classes. Package Access. Using the This Reference. Finalizers. Static Class Members. Data Abstraction and Information Hiding.

9. Object-Oriented Programming.

Introduction. Superclasses and Subclasses. Protected Members. Relationship between Superclass Objects and Subclass Objects. Constructors and Finalizers in Subclasses. Implicit Subclass-Object-to-Superclass-Object Conversion. Software Engineering with Inheritance. Composition vs. Inheritance. Case Study: Point, Circle, Cylinder. Introduction to Polymorphism. Type Fields and Switch Statements. Dynamic Method Binding. Final Methods and Classes. Abstract Superclasses and Concrete Classes. Polymorphism Examples. Case Study: A Payroll System Using Polymorphism. New Classes and Dynamic Binding. Case Study: Inheriting Interface and Implementation. Case Study: Creating and Using Interfaces. Inner Class Definitions. Notes on Inner Class Definitions. Type-Wrapper Classes for Primitive Types.

10. Strings and Characters.

Introduction. Fundamentals of Characters and Strings. String Constructors. String Methods Length, charAt and getChars. Comparing Strings. String Method hashCode. Locating Characters and Substrings in Strings. Extracting Substrings from Strings. Concatenating Strings. Miscellaneous String Methods. Using String Method valueOf. String Method Intern. StringBuffer Class. StringBuffer Constructors. StringBuffer Methods Length, Capacity. setLength and ensureCapacity. StringBuffer Methods charAt, setCharAt, getChars and Reverse. StringBuffer Append Methods. StringBuffer Insertion and Deletion Methods. Character Class Examples. Class StringTokenizer. A Card Shuffling and Dealing Simulation.

11. Graphics and Java2D.

Introduction. Graphics Contexts and Graphics Objects. Color Control. Font Control. Drawing Lines, Rectangles and Ovals. Drawing Arcs. Drawing Polygons and Polylines. The Java2D API. Java2D Shapes.

12. Basic Graphical User Interface Components.

Introduction. Swing Overview. Jlabel. Event Handling Model. JtextField and JpasswordField. Jbutton. JcheckBox and JradioButton. JcomboBox. Jlist. Multiple-Selection Lists. Mouse Event Handling. Adapter Classes. Keyboard Event Handling. Layout Managers. Panels.

13. Advanced Graphical User Interface Components.

Introduction. JtextArea. Creating a Customized Subclass of Jpanel. Creating a Self-Contained Subclass of Jpanel. Jslider. Windows. Designing Programs that Execute as Applets or Applications. Using Menus with Frames. Using JpopupMenus. Pluggable Look-and-Feel. Using JdesktopPane and JinternalFrame. Layout Managers. BoxLayout Layout Manager. CardLayout Layout Manager. GridBagLayout Layout Manager. GridBagConstraints Constants RELATIVE and REMAINDER.

14. Exception Handling.

Introduction. When Exception Handling Should Be Used. Other Error Handling Techniques. The Basics of Java Exception Handling. An Exception Handling Example: Divide by Zero. Try Blocks. Throwing an Exception. Catching an Exception. Rethrowing an Exception. Throws Clause. Constructors, Finalizers and Exception Handling. Exceptions and Inheritance. Finally Block. Using printStackTrace and getMessage.

15. Multithreading.

Introduction. Class Thread: An Overview of the Thread Methods. Thread States: Life Cycle of a Thread. Thread Priorities and Thread Scheduling. Thread Synchronization. Producer/Consumer Relationship without Thread Synchronization. Producer/Consumer Relationship with Thread Synchronization. Producer/Consumer Relationship: The Circular Buffer. Daemon Threads. Runnable Interface. Thread Groups.

16. Multimedia: Images, Animation, Audio and Video.

Introduction. Downloading the Java Media Framework. Loading, Displaying and Scaling Images. Loading and Playing Audio Clips. The Java Media Player. Animating a Series of Images. Animation Issues. Customizing Applets via the HTML param Tag. Image Maps. Java Plug-In. Internet and World Wide Web Resources.

17. Files and Streams.

Introduction. Data Hierarchy. Files and Streams. Creating a Sequential-Access File. Reading Data from a Sequential-Access File. Updating Sequential-Access Files. Random-Access Files. Creating a Random-Access File. Writing Data Randomly to a Random-Access File. Reading Data Sequentially from a Random-Access File. Example: A Transaction-Processing Program. Class File.

18. Java Database Connectivity (JDBC).

Introduction. Database Systems. Relational Database Model. Relational Database Overview: The Books.mdb Database. Structured Query Language. A First Example. Reading, Inserting, and Updating a Microsoft Access database. Transaction Processing.

19. Servlets.

Introduction. Overview of Servlet Technology. Downloading the Java Servlet Development Kit. Handling HTTP GET Requests. Handling HTTP POST Requests. Session Tracking. Multitier Applications: Using JDBC from a Servlet. Electronic Commerce. Servlet Internet and World Wide Web Resources.

20. Remote Method Invocation (RMI).

Introduction. Case Study: Creating a Distributed System with RMI. Defining the Remote Interface. Implementing the Remote Interface. Define the Client. Compile and Execute the Server and the Client.

21. Networking.

Introduction. Manipulating URLs. Reading a File on a Web Server. Establishing a Simple Server (Using Stream Sockets). Establishing a Simple Client (Using Stream Sockets). Client/Server Interaction with Stream Socket Connections. Connectionless Client/Server Interaction with Datagrams. Client/Server Tic-Tac-Toe Using a Multithreaded Server. Security and the Network.

22. Data Structures.

Introduction. Self-Referential Classes. Dynamic Memory Allocation. Linked Lists. Stacks. Queues. Trees.

23. Java Utilities Package and Bit Manipulation.

Introduction. Vector Class and Enumeratio Interface. Stack Class. Dictionary Class. Hashtable Class. Properties Class. Random Class. Bit Manipulation and the Bitwise Operators. BitSet Class.

24. Collections.

Introduction. Overview. Class Arrays. Interface Collection and Class Collections. Lists. Algorithms. Sets. Maps. Synchronization Wrappers. Unmodifiable Wrappers. Abstract Implementations.

25. JavaBeans.

Introduction. BeanBox Overview. Preparing a Class to Be a JavaBean. Creating a JavaBean: Java Archive Files and the jar Utility. Adding Beans to the BeanBox. Connecting Beans with Events in the BeanBox. Adding Properties to a JavaBean. Creating a JavaBean with a Bound Property. Specifying the BeanInfo Class for a JavaBean. JavaBeans World Wide Web Resources.

Appendix A: Demos.

Introduction. The Sites.

Appendix B: Java Resources.

Introduction. Resources. Products. FAQs. Tutorials. Magazines. Java Applets. Multimedia. Servlets. JavaBeans. Java CORBA. Newsgroups.

Appendix C: Operator Precedence Chart.

Appendix D: ASCII Character Set.

Appendix E: Number Systems.

Introduction. Abbreviating Binary Numbers as Octal Numbers and Hexadecimal Numbers. Converting Octal Numbers and Hexadecimal Numbers to Binary Numbers. Converting from Binary, Octal, or Hexadecimal to Decimal. Converting from Decimal to Binary, Octal, or Hexadecimal. Negative Binary Numbers: Two's Complement Notation.

Appendix F: Object-Oriented Elevator Simulator.

Introduction. Problem Statement. Elevator Laboratory Assignment 1. Elevator Laboratory Assignment 2. Elevator Laboratory Assignment 3. Elevator Laboratory Assignment 4. Elevator Laboratory Assignment 5. Elevator Laboratory Assignment 6. Elevator Laboratory Assignment 7. Elevator Laboratory Assignment 8. Elevator Laboratory Assignment 9. Elevator Laboratory Assignment 10. Elevator Laboratory Assignment 11. Elevator Laboratory Assignment 12. Design Review Questions. Recommended Modifications.

Appendix G: Creating HTML Documentation with javadoc.

Introduction. Documentation Comments. Documenting Java Source Code. javadoc. Files Produced by javadoc.

Appendix H: Enterprise JavaBeans (EJB) Web Resources.

Introduction. Tutorials. Demos. Resources. Developers. Specifications. Frequently Asked Questions (FAQs). Magazines.

Appendix I: Jini Web Resources.

Introduction. Tutorials. Resources. Demos. Specifications. FAQs. Magazines.




New Features in Java How to Program: Third Edition

This edition contains many new features and enhancements including:

  • Updated to the new Java 2 platform.
  • Uses Swing GUI components in all programs with graphical user interfaces.
  • Simplified early chapters to make learning Java easier for nonprogrammers.
  • Introduced GUI event handling later (Chapter 6, "Methods") so nonprogrammers have a foundation of basic programming concepts before seeing this complex topic.
  • Switched the emphasis from applets to applications to demonstrate Java the way it is typically used in industry.
  • Enhanced the coverage of interfaces.
  • Enhanced the coverage of GUI event handling.
  • Introduced inner classes and their use with GUI event handling.
  • Added coverage of Java's new Java2D graphics capabilities.
  • Added coverage of the Java Media Framework (JMF).
  • Added chapters on Java Database Connectivity (JDBC), Servlets and Remote Method Invocation (RMI) — crucial in building multitier client/server systems.
  • Added a chapter on Collections — Java's reusable data structures and the prepackaged algorithms for manipulating these data structures.
  • Added a chapter on JavaBeans — Java's reusable software component technology.
  • Updated appendices on Java demos and Java Internet and Web resources.
  • Added an appendix on javadoc (part of Sun's Java 2 Software Development Kit) — the utility that creates HTML documentation from comments in a program.
  • Added an appendix of Internet and Web resources for Enterprise JavaBeans.
  • Added an appendix of Internet and Web resources for Jini.

Java How to Program: Third Edition includes:

  • 16,485 Lines of Code in 220 Example Programs (with Program Outputs)
  • 456 Illustrations/Figures
  • 588 Programming Tips
  • Summaries (1016 Summary bullets)
  • Terminology Reviews (2295 Terms)
  • 444 Self-Review Exercises and Answers (Count Includes Separate Parts)
  • 959 Exercises (Solutions in Instructor's Manual; Count Includes Separate Parts)
  • Approximately 5700 Index Entries (with approximately 9300 Page References)
Software Included with Java How to Program: Third Edition

The CD-ROM at the end of this book contains Sun Microsystem's J2SDK 1.2.1 (i.e., Java 2) software development kit and two powerful Java integrated development environments (IDEs)-NetBeans DeveloperX2 and Borland JBuilder 3 University Edition. The CD also contains the book's examples and an HTML Web page with links to the Deitel & Associates, Inc. Web site, the Prentice Hall Web site and the many Web sites listed in the Appendices. If you have access to the Internet, this Web page can be loaded into your World Wide Web browser to give you quick access to all the resources.

NetBeans DeveloperX2 is a professional IDE written in Java that includes a graphical user interface designer, code editor, compiler, visual debugger and more. J2SDK 1.2.1 must be installed before installing DeveloperX2.

Borland JBuilder 3 University Edition is a customized version of JBuilder designed to meet the unique needs of the education market. The JBuilder 3 University Edition IDE includes an application browser, project manager, code editor, HTML viewer, graphical debugger and compiler. JBuilder 3 supports the latest Java standards, including Java 2, JavaBeans, JAR files, inner classes, internationalization, security and more.

If you have any questions about using this software, please read the introductory documentation on the CD-ROM. We will be putting additional information on our Web site: http://www.deitel.com.


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership