Synopses & Reviews
Java: First Contact has been written from the ground up providing students with no programming background an introduction to object-oriented programming using the Java language. The authors introduce the use of pre-existing objects right from the start, laying the groundwork for successfully learning all major Java objects. This includes learning how to write objects, understanding the importance of inheritance, and object-oriented design. As a result, students establish a strong foundation in the object model so they can build an object-oriented system from start to finish. The book covers all major aspects of the Java language, including making use of classes from the Java standard library. In cases where standard classes are too complex, author defined classes are available. Later chapters are dedicated to covering advanced aspects of the Java language, including GUI's, applets, input/output, and elementary data structures, enabling students to use a wide variety of tools when writing Java programs.
Table of Contents
Preface. Chapter 1. PROGRAMMING AND THE JAVA LANGUAGE. Programs and Programming. Algorithms. High Level Languages and Programs. A Simple Computer. Machine Code. Files and the Filing System. The World Wide Web. The Java Programming Language. Getting Started with Java. A First Java Program. The print and println Methods. How this Book is arranged. Key Points in Chapter 1. Exercises. Chapter 2. OBJECT ORIENTATION. Introduction: Objects and Classes. Software Objects. More about Single Objects. An Object-Oriented Program. Types. Classes and Instances Revisited. Key Points in Chapter 2. Exercises. Chapter 3. DECLARING OBJECTS AND CALLING METHODS. Introduction. The class Person. A Program to Manipulate a Person. The import Statement. Declaring Objects. Using Methods to Set the Attributes of Objects. Using Methods to Extract Object Attributes. Using Constants in Java. Using Objects and Methods. A Variety of Methods. Constructors Revisited. Input to a Program (Optional). Key Points in Chapter 3. Exercises. Chapter 4. SELECTING AMONG ALTERNATIVES. Reading Values from the Keyboard. More in Integer Variables. Type Checking. Making Decisions. Selection Statements in Java. Statements. Relational Operators and Boolean Expressions. The Boolean Type. The switch Statement. Testing a New Class. Key Points in Chapter 4. Exercises. Chapter 5. REPETITION. Repetition as a Basic Control Structure. Looping a Predetermined Number of Times—the for Statement. Looping an Indeterminate Number of Times—the while Statement. Stopping in the Middle of an Iteration. For Loops and while Loops. Nested Loops. Boolean Expressions for loops. Testing at the End of the Loop. Other Java Loop Features. Key Points in Chapter 5. Exercises. Chapter 6. BASIC JAVA DATA TYPES. Objects and Basic Data Types. Declaration. Setting a Value. Obtaining a Value. Arguments to Methods. The int Data Type. Other Whole Number Data Types in Java (Optional). Floating-Point Data Types. The boolean Data Type. The char Data Type. The String Class. Methods for the String Class. Wrapper Classes (Optional). Key Points in Chapter 6. Exercises. Chapter 7. A SIMPLE CLASS. Introduction. Providing the Person Class. Methods for the Person Class. Actual and Formal Arguments. Modes of Argument Passing. Return Values. Lexical Conventions within a Class. Key Points in Chapter 7. Exercises. Chapter 8. MORE ON THE SIMPLE CLASS. Constructor Methods. Overloading. Class Constants. Class Variables. Private Methods. Class or Static Methods. Revisiting the Main Class. Packages and Directories. The import Statement. Scope and Visibility. Intraclass Visibility. Use of this. Interclass Visibility. Key Points in Chapter 8. Exercises. Chapter 9. ARRAYS. Collections of Elements. Arrays of Objects. Searching an Array. Binary Search. Sorting an Array. Arrays as Arguments. Multi-Dimensional Arrays. Non-rectangular Arrays (Optional). Key Points in Chapter 9. Exercises. Chapter 10. OBJECTS WITHIN OBJECTS. Introduction. Writing the OurDate Class. Using the OurDate Class. Objects as Arguments. Multiple References to the Same Object. Objects as Arguments and Return Values: Call by Reference. Changing the Contents of the Formal and Actual Arguments. Hiding References to Other Objects. Key Points in Chapter 10. Exercises. Chapter 11. PUTTING OBJECTS TO WORK. A Task Organizer Program. A Priority Queue Class. Implementing a Priority Queue with an Array. Alternative Implementations of Priority Queue (Optional). Testing the PriorityQueue Class. Using the PriorityQueue Class. Outstanding Issues. Key Points in Chapter 11. Exercises. Chapter 12. INTRODUCTION TO INHERITANCE. Motivation. Data Modeling. Programming. Whats the Difference? Overriding Inherited Methods. Access Rights and Subclasses. Aeroplane Reservations: an Example. Key Points in Chapter 12. Exercises. References. Chapter 13. CLASS AND METHOD POLYMORPHISM. Person and Student: an Example. Constructor Methods and Inheritance. Constructor Chaining. Multiple Levels of Inheritance: the Inheritance Hierarchy. The Class Object. Polymorphism. Polymorphism and Heterogeneous Collections. Dynamic Method Binding (Late Binding). Calling Overridden Methods. Methods in Derived Classes. Key Points in Chapter 13. Exercises. Chapter 14. ABSTRACT CLASSES AND INTERFACES. Abstract Classes. Polymorphism. Interfaces. Key Points in Chapter 14. Exercises. Chapter 15. THROWING AND CATCHING EXCEPTIONS. Introduction. Defining a New Exception. Throwing an Exception. Catching an Exception. The finally Clause (Optional). Key Points in Chapter 15. Exercises. Chapter 16. GRAPHICS AND THE ABSTRACT WINDOWING TOOLKIT. Graphical User Interfaces. A Simple Program with a Graphical Interface. Writing the Chapter16n0 Class. The Constructor for the Chapter16n0 Class. Other Layout Managers. The main Method for the Chapte16n0 Class. The actionPerformed Method of the Chapter16n0 Class. The windowClosing Method of the Chapter16n0 Class. Writing the Canvas0 Class. Writing Text on the Canvas. Animating the Simple Graphics Program. Input of Character Strings in a Graphical Interface. Setting up the Picture. Getting a String from a TextField. Drawing the Thermometer. Menus, Files and Images (Optional). Setting up Menus. Selecting a File. Displaying an Image. Tracking the Mouse. Key Points in Chapter 16. Exercises. Chapter 17. LINKED DATA STRUCTURES. Linear and Linked Data Structures. Implementing a Priority Queue using a Linked Data Structure. Methods for the PriorityQueue Class. The length Method. The first Method. The remove Method. The insert Method. Deletion from a Linked Data Structure (Optional). Doubly-linked Lists (Optional). Using Linked Data Structures. Key Points in Chapter 17. Exercises. Chapter 18. RECURSION AND BINARY TREES. An Introduction to Recursion. Solving the Towers of Hanoi Problem. A Recursive Solution to the Towers of Hanoi Problem. An Iterative Solution to the Towers of Hanoi Problem. Binary Trees. Searching and Updating a Binary Tree. Writing the Code for the Binary Tree. Adding a Word Occurrence to the Lexicon. Outputting the Lexicon Information. Key Points in Chapter 18. Exercises. Chapter 19. INPUT AND OUTPUT IN JAVA. Introduction. The Java Classes for Input and Output. The PrintStream Class and System.out. Output Redirection. The BufferedReader Class and System.in. Tokenizing an Input Line. Converting Strings to Numeric Values. Redirection of Input. Files and File Handling. Reading and Writing Files. Writing to a File. Reading from a File. Binary Files (Optional). Random Access Files (Optional). Accessing other Computers (Optional). Key Points in Chapter 19. Exercises. Chapter 20. CREATING AND USING APPLETS. Creating Applets. Using Applets. More about Applets. A Useful Applet. The readIndex Method. The actionPerformed Method. Security Aspects of the Use of Applets. Key Points in Chapter 20. Exercises. Chapter 21. OTHER FEATURES OF JAVA. Vectors and other Java Data Structures. The Vector Class. The Hashtable Class. Strings and StringBuffers. Run-time Type Information (Optional). Threads (Optional). Synchronizing Threads. Key Points in Chapter 21. Exercises. Chapter 22. OBJECT ORIENTED DESIGN. Introduction. The Software Life Cycle. Requirements. Design. Coding. Testing. Maintenance. Design. The Design Process. Functional Design. Object-oriented Design (OOD). Capturing our Design: a Design Notation. Object Identification. Key Points in Chapter 22. Exercises. References. Chapter 23. CASE STUDY: IMPLEMENTING THE PERSONAL ORGANIZER (1). Introduction. FileOrganization. Index Sequential Access. The Main File. The RandomAccessFile Class. The Index. Suitability of the Vector Class for Internal Representation of the Index. Suitability of the Hashtable Class for Internal Representation of the Index. Using the Vector Class Indirectly. The Classes in Detail. Filing System Considerations. Clientship. Moving towards Implementation. The DirBase Class. The DirEntry Class. The IndexElem Class. The Index Class. Key Points in Chapter 23. Exercise. Reference. Chapter 24. CASE STUDY: IMPLEMENTING THE PERSONAL ORGANIZER (2). Introduction. Implementation of DirBase, Index, IndexElem and DirEntry. DirEntry Class Source and Commentary. IndexElem Class Source and Commentary. Index Class Source and Commentary. DirBase Class Source and Commentary. Testing What We Have Done So Far. Using a StreamTokenizer. Test-Based Interface—Intermediate Application and Testing. What Are We Testing?. Graphical User Interface—The Final Prototype Application. Testing the Graphical Interface. Using Inheritance. Key Points in Chapter 24. Exercises. Reference. Chapter 25. CRITERIA FOR A GOOD OBJECT-ORIENTED DESIGN. Introduction. Cohesion. Coupling. The Law of Demeter. Clarity. Extensibility of Our Design. Adding an E-mail Attribute to a Directory Entry. Adding a Diary Feature to the Personal Organizer. Key Points in Chapter 25. Exercises. References. Appendix A: Getting Started with Java. Appendix B: Keywords in Java. Appendix C: ASCII and Unicode Characters. Appendix D: Program Listing. Person.Java. Chapter20n2.java. The Gui Source Code for the Java Personal Organizer. The Gui Class. The DirGui Class. The BrowseRecGui Class. The NewRecGui Class. The AlertDialog Class.