Introduction to Java Programming, Brief Version / Edition 11

Introduction to Java Programming, Brief Version / Edition 11

by Y. Liang
ISBN-10:
0134611039
ISBN-13:
2900134611036
Pub. Date:
03/02/2017
Publisher:
Introduction to Java Programming, Brief Version / Edition 11

Introduction to Java Programming, Brief Version / Edition 11

by Y. Liang
$160.67
Current price is , Original price is $283.72. You
$283.72 
  • SHIP THIS ITEM
    Temporarily Out of Stock Online
  • PICK UP IN STORE

    Your local store may have stock of this item.

$160.67  $283.72 Save 43% Current price is $160.67, Original price is $283.72. You Save 43%.
  • SHIP THIS ITEM

    Temporarily Out of Stock Online

    Please check back later for updated availability.

    Note: Access code and/or supplemental material are not guaranteed to be included with used textbook.

Overview

This book covers JDK 1.2—the newest version of this programming language, principles of programming, and core Java features. A step-by-step approach first lays a sound foundation on programming elements, control statements, and methods, and then introduces object-oriented programming, finally moving on to graphical user interface, applets, internationalization, multithreading, multimedia, I/O, and networking. Representative examples, abundant pedagogy, and multiple exercises provide users with an outstanding introduction to Java. Chapter topics include primitive data types and operations; control statements; methods; programming with objects and classes; class inheritance; arrays and vectors; getting started with graphics programming; creating user interfaces; applets and advanced graphics; exception handling; internationalization; multithreading; multimedia; input and output; and networking. For professionals learning Java programming with Jbuilder3.

Product Details

ISBN-13: 2900134611036
Publication date: 03/02/2017
Pages: 832
Product dimensions: 6.00(w) x 1.25(h) x 9.00(d)

About the Author

Dr. Y. Daniel Liang earned his Ph.D. in Computer Science from the University of Oklahoma in 1991, and an MS and BS in Computer Science from Fudan University in Shanghai, China, in 1986 and 1983. Prior to joining Armstrong, he was an associate professor in computer science at Purdue University in Fort Wayne, where he twice received the Excellence in Research award.
Dr. Liang was trained in theoretical computer science. He was active in graph algorithms from 1990 to 1995 and published more than ten papers in several established journals such as SIAM Journal on Computing, Discrete Applied Mathematics, Acta Informatics, and Information Processing Letters. Since 1996, he has devoted to writing texts and published more than thirty books with Prentice Hall. His popular computer science texts are widely adopted in the world.
Dr. Liang was elected a Java Champion in 2005 by Sun Microsystems and has given lectures on Java internationally.

Read an Excerpt

PREFACE:

PREFACE

To the Instructor

There are three popular strategies in teaching Java. The first is to mix Java applets and graphics programming with object-oriented programming concepts. The second is to introduce object-oriented programming from the start. The third strategy is a step-by-step approach, first laying a sound foundation on programming concepts, control statements, and methods, then introducing object-oriented programming, and finally moving on to graphical user interface (GUI), applets, internationalization, multithreading, multimedia, I/O, and networking.

The first strategy, starting with GUI and applets, seems attractive, but requires substantial knowledge of object-oriented programming and a good understanding of the Java event-handling model; thus, students may never fully understand what they are doing. The second strategy is based on the notion that the objects should be introduced first because Java is an object-oriented programming language. This notion, however, does not strike a chord with students. From the more than 40 Java courses I have taught, I have concluded that introducing primary data types, control structures, and methods prepares students to learn object-oriented programming. Therefore, this text adopts the third strategy, first proceeding at a steady pace through all the necessary and important basic concepts, then moving to object-oriented programming, and then to using the object-oriented approach to build interesting GUI applications and applets with multithreading, multimedia, I/O, and networking.

The book is suited for both beginning and advanced students, depending on how it is used. Thisbook has been used in a two-semester freshman programming course and a one-semester course in Java as a second language. It has also been used for a short training course for experienced programmers. Computer science departments, engineering departments, and management information systems departments around the world have used this book at various levels. For students with no programming experience, the emphasis should be on Part I of the book, particularly on writing the loops. You could spend the entire semester of four credit hours just on the first six chapters of the book.

The Instructor's Manual on CD-ROM is available for instructors using this book. It contains the following resources:

  • Microsoft PowerPoint slides for lectures.
  • Answers to review questions.
  • Source code for the examples in the book.
  • The new edition provides 45% more programming exercises. Instructor's Solutions are provided in the Instructor's Manual. Students will have access to the solutions of even-numbered exercises.
  • Over 450 multiple-choice and true-or-false questions and answers covering all of the chapters of the book in sequence. These questions can be used in the exams or as additional review questions.

To obtain the Instructor's Manual, contact your Prentice-Hall sales representative.

Microsoft PowerPoint slides, answers to review questions, solutions to even-numbered programming exercises, and source code for the examples in the book are also available at the book's companion Web site at www.cs.armstrong.edu/liang/intro3e.html and www.prenhall.com/liang

Pedagogical Features of the Book

Introduction to Java Programming Third Edition uses the following elements to get the most out of the material:

  • Objectives lists what students should have learned from the chapter. This will help them to determine whether they have met the objectives after completing the chapter.
  • Introduction opens the discussion with a-brief overview of what to expect from the chapter.
  • Programming concepts are taught by representative Examples, carefully chosen and presented in an easy-to-follow style. Each example is described, and includes the source code, a sample run, and an example review. The source code of the examples is contained in the companion CD-ROM.
  • Each program is complete and ready to be compiled and executed. The sample run of the program is captured from the screen to give students a live presentation of the example. Reading these examples is much like entering and running them on a computer.
  • Chapter Summary reviews the important subjects that students should understand and remember. It helps them to reinforce the key concepts they have learned in the chapter.
  • Review Questions help students to track their progress and evaluate their learning.
  • Programming Exercises at the end of each chapter provide students with opportunities to apply the skills on their own. The trick of learning programming is practice, practice, and practice. To that end, the book provides a large number of exercises.
  • Notes and Tips are inserted throughout the text to offer valuable advice and insight on important aspects of program development.
    – NOTE: Provides additional information on the subject and reinforces important concepts.
    – TIP: Teaches good programming style and practice, and helps students steer away from the pitfalls of programming errors.

What's New in This Edition

This book expands and improves upon the second edition of Introduction to Java Programming. The major changes are as follows:

  • The use of UML enhances the treatment of object-oriented design and programming. UML graphical notations are used to describe classes and their relationships throughout the book.
  • Beginning with Chapter 8, "Getting Started with Graphics Programming," all the AWT user interface components are replaced with state-of-the-art Swing components.
  • Chapter 12, "Internationalization," is brand-new. It introduces date, time, and number formatting, and the development of Java programs for international audiences.
  • Several new case studies are provided to give more examples for learning the fundamentals of programming, such as writing loops.
  • Nonessential sections are marked optional and can be skipped or covered later with no adverse effect on the students' understanding of subsequent chapters. These sections include such topics as recursion, advanced layout managers, and resource bundles.
  • Several new appendices provide readers with additional background information.

To the Student

There is nothing more important to the future of computing than the Internet. There is nothing more exciting on the Internet than Java. A revolutionary programming language developed by Sun Microsystems, Java has become the de facto standard for cross-platform applications and programming on the World Wide Web.

Before Java, the Web was used primarily for viewing static information on the Internet using HTML, a marked-up language for document layout and for linking documents over the Internet. Java programs can be embedded in an HTML page and downloaded by Web browsers to bring live animation and interactive applications to Web clients.

Java is a full-featured, general-purpose programming language that is capable of developing robust mission-critical applications. In the last three years, Java has gained enormous popularity and has quickly become the most popular and successful programming language. Today, it is used not only for Web programming, but also for developing standalone applications. Many companies that once considered Java to be more hype than substance are now using it to create distributed applications accessed by customers and partners across the Internet. For every new project being developed today, companies are asking how they can use Java to make their work easier.

Java's Design and Advantages

Java is an object-oriented programming language. Object-oriented programming is a favored programming approach that has replaced traditional procedure-based programming techniques. An object-oriented language uses abstraction, encapsulation, inheritance, and polymorphism to provide great flexibility, modularity, and reusability for developing software.

Java is platform-independent. Its programs can run on any platform with a Java Virtual Machine, a software component that interprets Java instructions and carries out associated actions.

Java is distributed. Networking is inherently built-in. Simultaneous processing can occur on multiple computers on the Internet. Writing network programs is treated as simple data input and output.

Java is multithreaded. Multithreading is the capability of a program to perform several tasks simultaneously, such as downloading a video file while playing the video at the same time. Multithreading is particularly useful in graphical user interfaces (GUI) and network programming. Multithread programming is smoothly integrated in Java. In other languages, you can only enable multithreading by calling procedures that are specific to the operating system.

Java is secure. Computers become vulnerable when they are connected with other computers. Viruses and malicious programs can damage your computer. Java is designed with multiple layers of security that ensure proper access to private data and restrict access to disk files.

Java's Versatility

Stimulated by the promise of writing programs once and running them anywhere, Java has become the most important programming language. IBM, Sun, and Apple, and many other vendors are working to integrate the Java Virtual Machine with their operating systems so that Java programs can run directly and efficiently on the native machine. Java programs run on full-featured computers, and also on consumer electronics and appliances.

Because of its great potential to unite existing legacy applications written on different platforms so that they can run together, Java has been perceived as a universal front end for the enterprise database. The leading database companies, IBM, Oracle, Sybase, and Informix, have extended their commitment to Java by integrating it into their products. Oracle, for example, enables Java applications to run on its server, and to deliver a complete set of Java-based development tools supporting the integration of current applications with the Web.

Learning Java

To the first time programmers, learning Java is like learning any high-level programming languages. The fundamentals of learning programming is to develop critical skills of formulating programmatic solutions for the programs and to translate the solutions into programs using the selection statements, loops, and methods.

Applying the concept of abstraction in the design and implementation of software projects is the key to developing software. The overriding objective of this book, therefore, is to teach students to use many levels of abstraction in solving problems and to see problems in small and in large.

Students with no programming experience should take a slow-pace approach in Part I of the book. I recommend you to complete all the exercises in Chapter 3 and 4 before moving to Chapter 5. Students new to object-oriented programming may need some time to become familiar with the concept of objects and classes. Once the principles are mastered, programming in Java is easy and productive. Students who know object-oriented programming languages like C++ and Smalltalk will find it easier to learn Java. In fact, they will find that Java is simpler than C++ and Smalltalk in many aspects.

Organization of the Book

This book is divided into four parts that, taken together, form a comprehensive introductory course on Java programming. Because knowledge is cumulative, the early chapters provide the conceptual basis for understanding Java and guide students through simple examples and exercises; subsequent chapters progressively present Java programming in detail, culminating with the development of comprehensive Java applications. The appendixes contain a mixed bag of topics, including an HTML tutorial.

Part I: Fundamentals of Programming

The first part of the book is a stepping stone that will prepare you to embark on the journey of learning Java. You will begin to know Java, and will learn how to write simple Java programs with primitive data types, control statements, and methods.

Chapter 1, "Introduction to Java," gives an overview of the major features of Java: object-oriented programming, platform-independence, Java bytecode, security, performance, multithreading, and networking. The chapter also introduces how to create, compile, and run Java applications and applets. Simple examples of writing applications and applets are provided, along with a brief anatomy of programming structures.

Chapter 2, "Primitive Data Types and Operations," introduces primitive data types, operators, and expressions. Important topics include identifiers, variables, constants, assignment statements, primitive data types, operators, and shortcut operators. Java programming style and documentation are also addressed.

Chapter 3, "Control Statements," introduces decision and repetition statements. Java decision statements include various forms of if statements, and the switch statement. Java repetition statements include the while loop, the do loop, and the for loop. The keywords break and continue are discussed.

Chapter 4, "Methods," introduces method creation, calling methods, passing parameters, returning values, method overloading, and recursion. Applying the concept of abstraction is the key to developing software. The chapter also introduces the use of method abstraction in problem-solving. The math class for performing basic math operations is introduced.

Part II: Object-Oriented Programming

In the book's second part, object-oriented programming is introduced. Java is a class-centric, object-oriented programming language that uses abstraction, encapsulation, inheritance, and polymorphism to provide great flexibility, modularity, and reusability in developing software. You will learn programming with objects and classes, arrays and strings, and class inheritance.

Chapter 5, "Programming with Objects and Classes," begins with objects and classes. The important topics include defining classes, creating objects, using constructors, passing objects to methods, instance and class variables, and instance and class methods, analyzing relationships among classes, and using the UML graphical notations to describe classes. Several examples are provided to demonstrate the power of the object-oriented programming approach. Students will learn the benefits (abstraction, encapsulation, and modularity) of object-oriented programming from these examples. There are more than 500 predefined Java classes grouped in several packages. Starting with this chapter, students will gradually learn how to use Java classes to develop their own programs. The classes string, stringBuffer, and stringTokenizer for storing and processing strings are introduced.

Chapter 6, "Class Inheritance," teaches how an existing class can be extended and modified as needed. Inheritance is an extremely powerful programming technique, further extending software reusability. Java programs are all built by extending predefined Java classes. The major topics include defining subclasses, using the keywords super and this, using the modifiers protected, final and abstract, polymorphism and dynamic binding, and casting objects. This chapter introduces the object class, which is the root of all Java classes. You will learn to use abstract classes, and interfaces.

Chapter 7, "Arrays and Vectors," explores an important structure: arrays for processing data in lists and tables. You will learn how to declare, initialize, and copy arrays. You will also learn how to use wrapper classes to encapsulate primitive data type values in objects for use in generic programming. This chapter introduces the vector class, which can be used to store an unspecified number of elements.

Part III: Graphics Programming

The third part of the book introduces Java graphics programming. Major topics include event-driven programming, creating graphical user interfaces, and writing applets. You will learn the architecture of Java graphics programming API and use the user interface components to develop graphics applications and applets.

Chapter 8, "Getting Started with Graphics Programming," introduces the concepts of Java graphics programming using Swing components. Topics include the Swing class hierarchy, event-driven programming, frames, panels, and simple layout managers (F1owLayout, GridLayout, and BorderLayout). The chapter also introduces drawing geometric figures in the graphics context.

Chapter 9, "Creating User Interfaces," introduces the user interface components: buttons, labels, text fields, text areas, combo boxes, lists, check boxes, radio buttons, menus, scrollbars, and scroll panes. Today's client/server and Web-based applications use a graphical user interface (GUI, pronounced "goo-ee"). Java has a rich set of classes to help you build GUIs.

Chapter 10, "Applets and Advanced Graphics," takes an in-depth look at applets, discussing applet behavior and the relationship between applets and other Swing classes. Applets are a special kind of Java class that can be executed from the Web browser. Students will learn how to convert applications to applets, and vice versa, and how to run programs both as applications and as applets. The chapter also introduces two advanced layout mangers (cardLayout and GridBagLayout) and the use of no layout. Advanced examples of handling mouse and keyboard events are provided. You will learn how to package and deploy Java applications and applets.

Part IV: Developing Comprehensive Projects

The book's final part is devoted to several advanced features of Java programming. You will learn how to use these features to develop comprehensive programs; for example, using exception handling to make your program robust, using multithreading to make your program more responsive and interactive, incorporating sound and images to make your program user-friendly, using input and output to manage and process a large quantity of data, and creating client/server applications with Java networking support.

Chapter 11, "Exception Handling," teaches students how to define exceptions, throw exceptions, and handle exceptions so that their programs can either continue to run or terminate gracefully in the event of runtime errors. The chapter discusses predefined exception classes, and gives examples of creating user-defined exception classes.

Chapter 12, "Internationalization," introduces the development of Java programs for international audiences. You will learn how to format dates, numbers, currencies, and percentages for different regions, countries, and languages. You will also learn how to use resource bundles to define which images and strings are used by a component depending on the user's locale and preferences.

Chapter 13, "Multithreading," introduces threads, which enable the running of multiple tasks simultaneously in one program. Students will learn how to use the Thread class and the Runnable interface to launch separate threads. The chapter also discusses thread states, thread priority, thread groups, and the synchronization of conflicting threads.

Chapter 14, "Multimedia," teaches how to incorporate sound and images to bring live animation to Java programs. Various techniques for smoothing animation are introduced.

Chapter 15, "Input and Output," introduces input and output streams. Students will learn the class structures of I/O streams, byte and character streams, file I/O streams, data I/O streams, print streams, delimited I/O, random file access, and interactive I/O.

Chapter 16, "Networking," introduces network programming. Students will learn the concept of network communication, stream sockets, client/server programming, and reading data files from the Web server.

Appendixes

This part of the book covers a mixed bag of topics. Appendix A lists Java keywords. Appendix B gives tables of ASCII characters and their associated codes in decimal and in hex. Appendix C shows the operator precedence. Appendix D summarizes Java modifiers and their usage. Appendix E introduces number systems and conversions among binary, decimal, and hex numbers. Appendix F introduces HTML basics. Appendix G lists UML Graphical Notations for describing classes and their relationships. Appendix H introduces packages for grouping classes. Appendix I gives a JBuilder 3.5 tutorial. Finally, Appendix J provides a glossary of key terms used in the text.

Table of Contents

I. FUNDAMENTALS OF PROGRAMMING.

1. Introduction to Java.
Introduction. The History of Java. Characteristics of Java. Java and the World Wide Web. The Java Language Specification. Java Development Tools. Java Applications. Anatomy of the Application Program. Java Applets (Optional). Anatomy of the Applet Program (Optional). Applications versus Applets (Optional).

2. Primitive Data Types and Operations.
Introduction. Writing Simple Programs. Identifiers. Variables. Assignment Statements. Constants. Numerical Data Types. Character Data Type. Boolean Data Type. Case Studies. Programming Style and Documentation. Programming Errors. Debugging (Optional).

3. Control Statements.
Introduction. Selection Statements. Loop Statements. Using the Keywords break and continue. Case Studies.

4. Methods.
Introduction. Creating a Method. Calling a Method. Passing Parameters. Overloading Methods. Method Abstraction. The Math Class. Case Studies. Recursion (Optional).

II. OBJECT-ORIENTED PROGRAMMING.

5. Programming with Objects and Classes.
Introduction. Objects and Classes. Constructors. Passing Objects to Methods. Visibility Modifiers and Accessor Methods. Class Variables, Constants, and Methods. The Scope of Variables. The Keyword this. Analyzing Relationships amongObjects. Case Studies. Java Application Programmer Interface. The String Class. The StringBuffer Class. The StringTokenizer Class.

6. Class Inheritance.
Introduction. Superclasses and Subclasses. Using the super Keyword. Overriding Methods. The object Class. The protected and final Modifiers. Abstract Classes. Polymorphism and Dynamic Binding. Casting Objects and the instanceof Operator. Interfaces. Inner Classes. Software Development Processes. Class-Design Guidelines.

7. Arrays and Vectors.
Introduction. Declaring and Creating Arrays. Initializing and Processing Arrays. Sorting Arrays. Searching Arrays. Array of Objects. Copying Arrays. Multidimensional Arrays. Processing Primitive Type Values as Objects. The Number Class and Its Subclasses. Command-Line Arguments. Case Studies (Optional). The Vector Class (Optional).

III. GRAPHICS PROGRAMMING.

8. Getting Started with Graphics Programming.
Introduction. The Java Graphics API. Frames. Layout Managers. Using Panels as Containers. Drawing Graphics in Panels. The Color Class. The Font and FontMetrics Classes. Drawing Geometric Figures. Case Studies. Event-Driven Programming.

9. Creating User Interfaces.
Introduction. JavaBeans. Buttons. Labels. Text Fields. Text Areas. Combo Boxes. Lists. Check Boxes. Radio Buttons. Borders. Message Dialog Boxes. Menus. Creating Multiple Windows. Scrollbars. Scroll Panes. Tabbed Panes.

10. Applets and Advanced Graphics.
Introduction. The Applet Classes. The JApplet Class. Running Applets in the Java Plug-In (Optional). The <> HTML Tag. Passing Parameters to Applets. Conversions between Applications and Applets. Running a Program as an Applet and an Application. Mouse Events. Keyboard Events. Modeling Dynamic Behavior Using Sequence Diagrams and Statecharts. Case Studies. Packaging and Deploying Java Projects (Optional). The CardLayout Manager (Optional). The GridBagLayout Manager (Optional). Using No Layout Manager (Optional).

IV. DEVELOPING COMPREHENSIVE PROJECTS.

11. Exception Handling.
Introduction. Exceptions and Exception Types. Understanding Exception Handling. Rethrowing Exceptions. The finally Clause. Cautions When Using Exceptions. Creating Custom Exception Classes (Optional).

12. Internationalization.
Introduction. The Locale Class. Processing Date and Time. Formatting Numbers. Resource Bundles (Optional).

13. Multithreading.
Introduction. Creating Threads by Extending the Thread Class. Creating Threads by Implementing the Runnable Interface. Controlling Threads and Thread States. Thread Groups. Synchronization. Creating Threads for Applets. Using the Timer Class to Control Animation. Case Studies.

14. Multimedia.
Introduction. Playing Audio. Running Audio on a Separate Thread. Displaying Images. Loading Images and Audio Files in Java Applications. Displaying a Sequence of Images. Using MediaTracker.

15. Input and Output.
Introduction. Stream Classes. The File Class and Processing External Files. Filter Streams. Data Streams. Print Streams. Buffered Streams. File Dialogs. Text Input and Output on the Console. Object Streams. Random Access Files. Parsing Text Files (Optional). Array Streams, Piped Streams, String Streams, Pushback Streams, and Line Number Streams (Optional).

16. Networking.
Introduction. Client/Server Computing. Serving Multiple Clients and the InetAddress Class. Applet Clients. Sending and Receiving Objects. The URL Class and Viewing Web Pages from Applets. Retrieving Files from Web Servers. Viewing HTML Files Using JEditorPane. Case Studies (Optional).

APPENDICES.

Appendix A: Java Keywords.
Appendix B: The ASCII Character Set.
Appendix C: Operator Precedence Chart.
Appendix D: Java Modifiers.
Appendix E: Number Systems.
Introduction. Conversions between Binary Numbers and Decimal Numbers. Conversions between Hexadecimal Numbers and Decimal Numbers. Conversions between Binary Numbers and Hexadecimal Numbers.

Appendix F: An HTML Tutorial.
Getting Started. Structure Tags. Text Appearance Tags. Paragraph-Style Tags. Font, Size, and Color Tags. List Tags. Table Tags. Hyperlink Tags. Embedding Graphics. More on HTML.

Appendix G: UML Graphical Notations.
Classes and Objects. The Modifiers, public, private, protected, and static. Class Relationships. Abstract Classes and Interfaces. Sequence Diagrams. Statechart Diagrams.

Appendix H: Packages.
Package-Naming Conventions. The Classpath Environment Variable. Putting Classes into Packages. Using Packages.

Appendix I: A JBuilder 3.5 Tutorial.
Introduction. What Is JBuilder 3.5? Obtaining and Installing JBuilder 3.5. Getting Started with JBuilder 3. Creating a Project. Setting Project Properties. Creating a Java Application. Compiling a Java Program. Executing a Java Application. Creating a Java Applet. Compiling and Viewing Applets in JBuilder 3.5. Using the MyInput Class in JBuilder 3.5. Some Known Problems of JBuilder 3.5.

Appendix J: Glossary. Index.

Preface

PREFACE:

PREFACE

To the Instructor

There are three popular strategies in teaching Java. The first is to mix Java applets and graphics programming with object-oriented programming concepts. The second is to introduce object-oriented programming from the start. The third strategy is a step-by-step approach, first laying a sound foundation on programming concepts, control statements, and methods, then introducing object-oriented programming, and finally moving on to graphical user interface (GUI), applets, internationalization, multithreading, multimedia, I/O, and networking.

The first strategy, starting with GUI and applets, seems attractive, but requires substantial knowledge of object-oriented programming and a good understanding of the Java event-handling model; thus, students may never fully understand what they are doing. The second strategy is based on the notion that the objects should be introduced first because Java is an object-oriented programming language. This notion, however, does not strike a chord with students. From the more than 40 Java courses I have taught, I have concluded that introducing primary data types, control structures, and methods prepares students to learn object-oriented programming. Therefore, this text adopts the third strategy, first proceeding at a steady pace through all the necessary and important basic concepts, then moving to object-oriented programming, and then to using the object-oriented approach to build interesting GUI applications and applets with multithreading, multimedia, I/O, and networking.

The book is suited for both beginning and advanced students, depending on how it is used.Thisbook has been used in a two-semester freshman programming course and a one-semester course in Java as a second language. It has also been used for a short training course for experienced programmers. Computer science departments, engineering departments, and management information systems departments around the world have used this book at various levels. For students with no programming experience, the emphasis should be on Part I of the book, particularly on writing the loops. You could spend the entire semester of four credit hours just on the first six chapters of the book.

The Instructor's Manual on CD-ROM is available for instructors using this book. It contains the following resources:

  • Microsoft PowerPoint slides for lectures.
  • Answers to review questions.
  • Source code for the examples in the book.
  • The new edition provides 45% more programming exercises. Instructor's Solutions are provided in the Instructor's Manual. Students will have access to the solutions of even-numbered exercises.
  • Over 450 multiple-choice and true-or-false questions and answers covering all of the chapters of the book in sequence. These questions can be used in the exams or as additional review questions.

To obtain the Instructor's Manual, contact your Prentice-Hall sales representative.

Microsoft PowerPoint slides, answers to review questions, solutions to even-numbered programming exercises, and source code for the examples in the book are also available at the book's companion Web site at www.cs.armstrong.edu/liang/intro3e.html and www.prenhall.com/liang

Pedagogical Features of the Book

Introduction to Java Programming Third Edition uses the following elements to get the most out of the material:

  • Objectives lists what students should have learned from the chapter. This will help them to determine whether they have met the objectives after completing the chapter.
  • Introduction opens the discussion with a-brief overview of what to expect from the chapter.
  • Programming concepts are taught by representative Examples, carefully chosen and presented in an easy-to-follow style. Each example is described, and includes the source code, a sample run, and an example review. The source code of the examples is contained in the companion CD-ROM.
  • Each program is complete and ready to be compiled and executed. The sample run of the program is captured from the screen to give students a live presentation of the example. Reading these examples is much like entering and running them on a computer.
  • Chapter Summary reviews the important subjects that students should understand and remember. It helps them to reinforce the key concepts they have learned in the chapter.
  • Review Questions help students to track their progress and evaluate their learning.
  • Programming Exercises at the end of each chapter provide students with opportunities to apply the skills on their own. The trick of learning programming is practice, practice, and practice. To that end, the book provides a large number of exercises.
  • Notes and Tips are inserted throughout the text to offer valuable advice and insight on important aspects of program development.
    – NOTE: Provides additional information on the subject and reinforces important concepts.
    – TIP: Teaches good programming style and practice, and helps students steer away from the pitfalls of programming errors.

What's New in This Edition

This book expands and improves upon the second edition of Introduction to Java Programming. The major changes are as follows:

  • The use of UML enhances the treatment of object-oriented design and programming. UML graphical notations are used to describe classes and their relationships throughout the book.
  • Beginning with Chapter 8, "Getting Started with Graphics Programming," all the AWT user interface components are replaced with state-of-the-art Swing components.
  • Chapter 12, "Internationalization," is brand-new. It introduces date, time, and number formatting, and the development of Java programs for international audiences.
  • Several new case studies are provided to give more examples for learning the fundamentals of programming, such as writing loops.
  • Nonessential sections are marked optional and can be skipped or covered later with no adverse effect on the students' understanding of subsequent chapters. These sections include such topics as recursion, advanced layout managers, and resource bundles.
  • Several new appendices provide readers with additional background information.

To the Student

There is nothing more important to the future of computing than the Internet. There is nothing more exciting on the Internet than Java. A revolutionary programming language developed by Sun Microsystems, Java has become the de facto standard for cross-platform applications and programming on the World Wide Web.

Before Java, the Web was used primarily for viewing static information on the Internet using HTML, a marked-up language for document layout and for linking documents over the Internet. Java programs can be embedded in an HTML page and downloaded by Web browsers to bring live animation and interactive applications to Web clients.

Java is a full-featured, general-purpose programming language that is capable of developing robust mission-critical applications. In the last three years, Java has gained enormous popularity and has quickly become the most popular and successful programming language. Today, it is used not only for Web programming, but also for developing standalone applications. Many companies that once considered Java to be more hype than substance are now using it to create distributed applications accessed by customers and partners across the Internet. For every new project being developed today, companies are asking how they can use Java to make their work easier.

Java's Design and Advantages

Java is an object-oriented programming language. Object-oriented programming is a favored programming approach that has replaced traditional procedure-based programming techniques. An object-oriented language uses abstraction, encapsulation, inheritance, and polymorphism to provide great flexibility, modularity, and reusability for developing software.

Java is platform-independent. Its programs can run on any platform with a Java Virtual Machine, a software component that interprets Java instructions and carries out associated actions.

Java is distributed. Networking is inherently built-in. Simultaneous processing can occur on multiple computers on the Internet. Writing network programs is treated as simple data input and output.

Java is multithreaded. Multithreading is the capability of a program to perform several tasks simultaneously, such as downloading a video file while playing the video at the same time. Multithreading is particularly useful in graphical user interfaces (GUI) and network programming. Multithread programming is smoothly integrated in Java. In other languages, you can only enable multithreading by calling procedures that are specific to the operating system.

Java is secure. Computers become vulnerable when they are connected with other computers. Viruses and malicious programs can damage your computer. Java is designed with multiple layers of security that ensure proper access to private data and restrict access to disk files.

Java's Versatility

Stimulated by the promise of writing programs once and running them anywhere, Java has become the most important programming language. IBM, Sun, and Apple, and many other vendors are working to integrate the Java Virtual Machine with their operating systems so that Java programs can run directly and efficiently on the native machine. Java programs run on full-featured computers, and also on consumer electronics and appliances.

Because of its great potential to unite existing legacy applications written on different platforms so that they can run together, Java has been perceived as a universal front end for the enterprise database. The leading database companies, IBM, Oracle, Sybase, and Informix, have extended their commitment to Java by integrating it into their products. Oracle, for example, enables Java applications to run on its server, and to deliver a complete set of Java-based development tools supporting the integration of current applications with the Web.

Learning Java

To the first time programmers, learning Java is like learning any high-level programming languages. The fundamentals of learning programming is to develop critical skills of formulating programmatic solutions for the programs and to translate the solutions into programs using the selection statements, loops, and methods.

Applying the concept of abstraction in the design and implementation of software projects is the key to developing software. The overriding objective of this book, therefore, is to teach students to use many levels of abstraction in solving problems and to see problems in small and in large.

Students with no programming experience should take a slow-pace approach in Part I of the book. I recommend you to complete all the exercises in Chapter 3 and 4 before moving to Chapter 5. Students new to object-oriented programming may need some time to become familiar with the concept of objects and classes. Once the principles are mastered, programming in Java is easy and productive. Students who know object-oriented programming languages like C++ and Smalltalk will find it easier to learn Java. In fact, they will find that Java is simpler than C++ and Smalltalk in many aspects.

Organization of the Book

This book is divided into four parts that, taken together, form a comprehensive introductory course on Java programming. Because knowledge is cumulative, the early chapters provide the conceptual basis for understanding Java and guide students through simple examples and exercises; subsequent chapters progressively present Java programming in detail, culminating with the development of comprehensive Java applications. The appendixes contain a mixed bag of topics, including an HTML tutorial.

Part I: Fundamentals of Programming

The first part of the book is a stepping stone that will prepare you to embark on the journey of learning Java. You will begin to know Java, and will learn how to write simple Java programs with primitive data types, control statements, and methods.

Chapter 1, "Introduction to Java," gives an overview of the major features of Java: object-oriented programming, platform-independence, Java bytecode, security, performance, multithreading, and networking. The chapter also introduces how to create, compile, and run Java applications and applets. Simple examples of writing applications and applets are provided, along with a brief anatomy of programming structures.

Chapter 2, "Primitive Data Types and Operations," introduces primitive data types, operators, and expressions. Important topics include identifiers, variables, constants, assignment statements, primitive data types, operators, and shortcut operators. Java programming style and documentation are also addressed.

Chapter 3, "Control Statements," introduces decision and repetition statements. Java decision statements include various forms of if statements, and the switch statement. Java repetition statements include the while loop, the do loop, and the for loop. The keywords break and continue are discussed.

Chapter 4, "Methods," introduces method creation, calling methods, passing parameters, returning values, method overloading, and recursion. Applying the concept of abstraction is the key to developing software. The chapter also introduces the use of method abstraction in problem-solving. The math class for performing basic math operations is introduced.

Part II: Object-Oriented Programming

In the book's second part, object-oriented programming is introduced. Java is a class-centric, object-oriented programming language that uses abstraction, encapsulation, inheritance, and polymorphism to provide great flexibility, modularity, and reusability in developing software. You will learn programming with objects and classes, arrays and strings, and class inheritance.

Chapter 5, "Programming with Objects and Classes," begins with objects and classes. The important topics include defining classes, creating objects, using constructors, passing objects to methods, instance and class variables, and instance and class methods, analyzing relationships among classes, and using the UML graphical notations to describe classes. Several examples are provided to demonstrate the power of the object-oriented programming approach. Students will learn the benefits (abstraction, encapsulation, and modularity) of object-oriented programming from these examples. There are more than 500 predefined Java classes grouped in several packages. Starting with this chapter, students will gradually learn how to use Java classes to develop their own programs. The classes string, stringBuffer, and stringTokenizer for storing and processing strings are introduced.

Chapter 6, "Class Inheritance," teaches how an existing class can be extended and modified as needed. Inheritance is an extremely powerful programming technique, further extending software reusability. Java programs are all built by extending predefined Java classes. The major topics include defining subclasses, using the keywords super and this, using the modifiers protected, final and abstract, polymorphism and dynamic binding, and casting objects. This chapter introduces the object class, which is the root of all Java classes. You will learn to use abstract classes, and interfaces.

Chapter 7, "Arrays and Vectors," explores an important structure: arrays for processing data in lists and tables. You will learn how to declare, initialize, and copy arrays. You will also learn how to use wrapper classes to encapsulate primitive data type values in objects for use in generic programming. This chapter introduces the vector class, which can be used to store an unspecified number of elements.

Part III: Graphics Programming

The third part of the book introduces Java graphics programming. Major topics include event-driven programming, creating graphical user interfaces, and writing applets. You will learn the architecture of Java graphics programming API and use the user interface components to develop graphics applications and applets.

Chapter 8, "Getting Started with Graphics Programming," introduces the concepts of Java graphics programming using Swing components. Topics include the Swing class hierarchy, event-driven programming, frames, panels, and simple layout managers (F1owLayout, GridLayout, and BorderLayout). The chapter also introduces drawing geometric figures in the graphics context.

Chapter 9, "Creating User Interfaces," introduces the user interface components: buttons, labels, text fields, text areas, combo boxes, lists, check boxes, radio buttons, menus, scrollbars, and scroll panes. Today's client/server and Web-based applications use a graphical user interface (GUI, pronounced "goo-ee"). Java has a rich set of classes to help you build GUIs.

Chapter 10, "Applets and Advanced Graphics," takes an in-depth look at applets, discussing applet behavior and the relationship between applets and other Swing classes. Applets are a special kind of Java class that can be executed from the Web browser. Students will learn how to convert applications to applets, and vice versa, and how to run programs both as applications and as applets. The chapter also introduces two advanced layout mangers (cardLayout and GridBagLayout) and the use of no layout. Advanced examples of handling mouse and keyboard events are provided. You will learn how to package and deploy Java applications and applets.

Part IV: Developing Comprehensive Projects

The book's final part is devoted to several advanced features of Java programming. You will learn how to use these features to develop comprehensive programs; for example, using exception handling to make your program robust, using multithreading to make your program more responsive and interactive, incorporating sound and images to make your program user-friendly, using input and output to manage and process a large quantity of data, and creating client/server applications with Java networking support.

Chapter 11, "Exception Handling," teaches students how to define exceptions, throw exceptions, and handle exceptions so that their programs can either continue to run or terminate gracefully in the event of runtime errors. The chapter discusses predefined exception classes, and gives examples of creating user-defined exception classes.

Chapter 12, "Internationalization," introduces the development of Java programs for international audiences. You will learn how to format dates, numbers, currencies, and percentages for different regions, countries, and languages. You will also learn how to use resource bundles to define which images and strings are used by a component depending on the user's locale and preferences.

Chapter 13, "Multithreading," introduces threads, which enable the running of multiple tasks simultaneously in one program. Students will learn how to use the Thread class and the Runnable interface to launch separate threads. The chapter also discusses thread states, thread priority, thread groups, and the synchronization of conflicting threads.

Chapter 14, "Multimedia," teaches how to incorporate sound and images to bring live animation to Java programs. Various techniques for smoothing animation are introduced.

Chapter 15, "Input and Output," introduces input and output streams. Students will learn the class structures of I/O streams, byte and character streams, file I/O streams, data I/O streams, print streams, delimited I/O, random file access, and interactive I/O.

Chapter 16, "Networking," introduces network programming. Students will learn the concept of network communication, stream sockets, client/server programming, and reading data files from the Web server.

Appendixes

This part of the book covers a mixed bag of topics. Appendix A lists Java keywords. Appendix B gives tables of ASCII characters and their associated codes in decimal and in hex. Appendix C shows the operator precedence. Appendix D summarizes Java modifiers and their usage. Appendix E introduces number systems and conversions among binary, decimal, and hex numbers. Appendix F introduces HTML basics. Appendix G lists UML Graphical Notations for describing classes and their relationships. Appendix H introduces packages for grouping classes. Appendix I gives a JBuilder 3.5 tutorial. Finally, Appendix J provides a glossary of key terms used in the text.

From the B&N Reads Blog

Customer Reviews