Welcome to Java! We have worked hard to create what we hope you will find to be an informative, entertaining and challenging learning experience. Java is a powerful computer programming language that is fun for novices and appropriate for experienced programmers to use in building substantial information systems. Java How to Program, Sixth Edition, is an effective learning tool for each of these audiences.
The core of the book emphasizes achieving program clarity through the proven techniques of object-oriented programming. Nonprogrammers will learn programming the right way from the beginning. The presentation is clear, straightforward and abundantly illustrated. It includes hundreds of working Java programs and shows the outputs produced when those programs are run on a computer. We teach Java features in the context of complete working Java programswe call this the live-code approach. The example programs are included on the CD that accompanies this book, or you may download them from www.deitel.com or www.prenhall.com/deitel.
The early chapters introduce the fundamentals of computers, computer programming and the Java computer programming language, providing a solid foundation for the deeper treatment of Java in the later chapters. Experienced programmers tend to read the early chapters quickly and find the treatment of Java in the later chapters rigorous and challenging.
Most people are familiar with the exciting tasks computers perform. Using this text-book, you will learn how to command computers to perform those tasks. It is software (i.e., the instructions you write to command computers to perform actions and make decisions) that controls computers (often referred to as hardware). Java, developed by Sun Microsystems, is one of today's most popular software development languages.
This book is based on Sun's Java 2 Platform, Standard Edition (J2SE). Sun provides an implementation of this platform, called the J2SE Development Kit (JDK), that includes the minimum set of tools you need to write software in Java. We used JDK version 5.0 to implement and test the programs in this book. When Sun makes the JDK available to publishers, it will be wrapped with the textbook on the accompanying CD. Sun updates the JDK on a regular basis to fix bugs. To download the most recent version of the JDK, visit java.sun.com/j2se.
Computer use is increasing in almost every field of endeavor. Computing costs have been decreasing dramatically due to rapid developments in both hardware and software technologies. Computers that might have filled large rooms and cost millions of dollars two decades ago can now be inscribed on silicon chips smaller than a fingernail, costing perhaps a few dollars each. Fortunately, silicon is one of the most abundant materials on earthit is an ingredient in common sand. Silicon chip technology has made computing so economical that hundreds of millions of general-purpose computers are in use worldwide, helping people in business, industry and government, and in their personal lives. The number could easily double in the next few years.
Over the years, many programmers learned the programming methodology called structured programming. You will learn structured programming and an exciting newer methodology, object-oriented programming. Why do we teach both? Object orientation is the key programming methodology used by programmers today. You will create and work with many software objects in this text. But you will discover that their internal structure is often built using structured-programming techniques. Also, the logic of manipulating objects is occasionally expressed with structured programming.
Java has become the language of choice for implementing Internet-based applications and software for devices that communicate over a network. Before long the stereo and other devices in your home will be networked together by Java technology. Don't be surprised when your wireless devices, like cell phones, pagers and personal digital assistants (PDAs), begin to communicate over the so-called wireless Internet via the kind of Java-based networking applications that you will learn in this book and its companion, Advanced Java 2 Platform How to Program. According to Sun's Web site (www.sun.com), in 2003, over 267 million cell phones equipped with Java technology were shipped! Java has evolved rapidly into the large-scale applications arena. It is no longer used simply to make World Wide Web pages come aliveit has become the preferred language for meeting the enterprise-wide programming needs of many organizations.
Java has evolved so rapidly that this sixth edition of Java How to Program has been written just eight years after the first edition was published. This edition is based on the Java 2 Platform, Standard Edition (J2SE) version 5.0. Java has grown so large that it now has two other editions. The Java 2 Platform, Enterprise Edition (J2EE), is geared toward developing large-scale, distributed networking applications and Web-based applications. The Java 2 Platform, Micro Edition (J2ME) is geared toward developing applications for small, memory-constrained devices, such as cell phones, pagers and PDAs. Advanced Java 2 Platform How to Program emphasizes developing applications with J2EE and provides coverage of several high-end topics from the J2SE. Advanced Java 2 Platform How to Program also includes substantial materials on J2ME and wireless-application development.
You are embarking on a challenging and rewarding path. As you proceed, if you would like to communicate with us, please send e-mail to
or browse our Web site at
We will respond promptly. To keep up to date with Java developments at Deitel & Associates, please register for our free e-mail newsletter, The Deitel Buzz Online, at
We hope that you will enjoy learning with Java How to Program.
Introduction to Computers, the Internet and the World Wide Web
Introduction to Java Applications
Introduction to Classes and Objects
Control Statements: Part I
Control Statements: Part 2
Methods: A Deeper Look
Classes and Objects: A Deeper Look
Object-Oriented Programming: Inheritance
Object-Oriented Programming: Polymorphism
GUI Components: Part 1
Graphics and Java 2D™
Files and Streams
Searching and Sorting
Introduction to Java Applets
Multimedia: Applets and Applications
GUI Components: Part 2
Accessing Databases with JDBC
JavaServer Pages (JSP)
Strings, Characters and Regular Expressions
Appendix A. Operator Precedence Chart
Appendix B. ASCII Character Set
Appendix C. Keywords and Reserved Words
Appendix D. Primitive Types
Appendix E. (On CD) Number Systems
Appendix F. (On CD) Unicode®
Appendix G. Using the Java API Documentation
Appendix H. (On CD) Creating Documentation with javadoc
Appendix I. (On CD) Bit Manipulation
Appendix J. (On CD) ATM Case Study Code
Appendix K. (On CD) Labeled break and continue Statements
Appendix L. (On CD) UML 2: Additional Diagram Types
Appendix M. (On CD) Design Patterns
Appendix N. Using the Debugger
Inside Back Cover