Java: How to Program

Front Cover
Prentice Hall, 1998 - Computers - 1063 pages
Preface 1 Introduction to Computers, the Internet and the Web 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 Fortran, Cobol, Pascal and Ada Basic, Visual Basic, Visual C++, C# and .NET The Internet and the World Wide Web Basics of a Typical Java Environment General Notes about Java and This Book Thinking About Objects: Introduction to Object Technology and the Unified Modeling Language Discovering Design Patterns: Introduction 2 Introduction to Java Applications A First Program in Java: Printing a Line of Text Modifying Our First Java Program Displaying Text in a Dialog Box Another Java Application: Adding Integers Memory Concepts Arithmetic Decision Making: Equality and Relational Operators (Optional Case Study) Thinking About Objects: Examining the Problem Statement 3 Introduction to Java Applets Sample Applets from the Java 2 Software Development Kit Simple Java Applet: Drawing a String Drawing Strings and Lines Adding Floating-Point Numbers Java Applet Internet and World Wide Web Resources (Optional Case Study) Thinking About Objects: Identifying the Classes in a Problem Statement 4 Control Statements: Part 1 Algorithms Pseudocode Control Structures If Selection Structure If/else Selection Statement While Repetition Statement 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) Compound Assignment Operators Increment and Decrement Operators Primitive Types (Optional Case Study) Thinking About Objects: Identifying Class Attributes 5 Control Statements: Part 2 Essentials of Counter-Controlled Repetition for Repetition Structure Examples Using the for Structure Do/while Repetition Statement Switch Multiple-Selection Statement Break and continue Statements Labeled break and continue Statements Logical Operators Structured Programming Summary (Optional Case Study) Thinking About Objects: Identifying Objects' States and Activities 6 Methods Program Modules in Java Math-Class Methods Methods Declarations Argument Promotion Java API Packages Random-Number Generation Example: A Game of Chance Scope of Declarations Methods of Class Japplet Method Overloading Recursion Example Using Recursion: The Fibonacci Series Recursion vs Iteration (Optional Case Study) Thinking About Objects: Identifying Class Operations 7 Arrays Arrays Declaring and Creating Arrays Examples Using Arrays References and Reference Parameters Passing Arrays to Methods Sorting Arrays Searching Arrays: Linear Search and Binary Search Multidimensional Arrays (Optional Case Study) Thinking About Objects: Collaboration Among Objects 8 Object-Based Programming Implementing a Time Abstract Data Type with a Class Class Scope Controlling Access to Members Referring to the Current Object's Members with this Initializing Class Objects: Constructors Using Overloaded Constructors Using Set and Get Methods Composition Garbage Collection Static Class Members Final Instance Variables Creating Packages Package Access Software Reusability Data Abstraction and Encapsulation (Optional Case Study) Thinking About Objects: Starting to Program the Classes for the Elevator Simulation 9 Object-Oriented Programming: Inheritance Superclasses and Subclasses Protected Members Relationship between Superclass Objects and Subclasses Case Study: Three-Level Inheritance Hierarchy Constructors and Finalizers in Subclasses Software Engineering with Inheritance 10 Object-Oriented Programming: Polymorphism Relationships Among Objects in an Inheritance Hierarchy Polymorphism Examples Abstract Classes and Methods Case Study: Inheriting Interface and Implementation Final Methods and Classes Case Study: Payroll System Using Polymorphism Case Study: Creating and Using Interfaces Nested Classes Type-Wrapper Classes for Primitive Types (Optional Case Study) Thinking About Objects: Incorporating Inheritance into the Elevator Simulation (Optional) Discovering Design Patterns: Introducing Creational, Structural, and Behavioral Design Patterns 11 Strings and Characters Fundamentals of Characters and Strings Class String Class StringBuffer Class Character Class StringTokenizer Card Shuffling and Dealing Simulation Regular Expressions, Class Pattern and Class Matcher (Optional Case Study) Thinking About Objects: Event Handling 12 Graphics and Java2D Graphics Contexts and Graphics Objects Color Control Font Control Drawing Lines, Rectangles and Ovals Drawing Arcs Drawing Polygons and Polylines The Java2D API (Optional Case Study) Thinking About Objects: Designing Interfaces with the UML 13 Graphical User Interface Components: Part 1 Overview of Swing Components JLabel Event-Handling Textfields How Event Handling Works Jbutton JCheckBox and JRadioButton JComboBox JList Multiple-Selection Lists Mouse Event Handling Adapter Classes Key Event Handling Layout Managers Panels (Optional Case Study) Thinking About Objects: Use Cases 14 Graphical User Interface Components: Part 2 JTextArea Creating a Customized Subclass of Jpanel Jpanel Subclass that handles Its Own Events JSlider Windows: Additional Notes Using Menus with Frames JPopupMenu Pluggable Look-and-Feel JDesktopPane and JInternalFrame JtabbedPane Layout Managers BoxLayout and GridBagLayout (Optional Case Study) Thinking About Objects: Model-View-Controller (Optional) Discovering Design Patterns: Design Patterns Used in Packages java.awt and javax.swing 15 Exception Handling Exception Handling Overview Exception-Handling Example: Divide by Zero Java Exception Hierarchy Rethrowing an Exception Finally Clause Stack Unwinding PrintStackTrace, getStackTrace and getMessage Chained Exceptions Declaring New Exception Types Constructors and Exception Handling 16 Multithreading Thread States: Life Cycle of a Thread Thread Priorities and Thread Scheduling Creating and Executing Threads Thread Synchronization Producer/Consumer Relationship without Synchronization Producer/Consumer Relationship with Synchronization Producer/Consumer Relationship: The Circular Buffer Daemon Threads Runnable Interface (Optional Case Study) Thinking About Objects: Multithreading (Optional) Discovering Design Patterns: Concurrent Design Patterns.

From inside the book

Contents

Developing Java Applications
xxxiii
Methods
xxxiv
Multithreading
xxxix
Copyright

74 other sections not shown

Other editions - View all

Common terms and phrases