Preface
List of Class Files
1 Object-Oriented Programming in Java
1.1 Objects and Encapsulation
1.1.1 Objects
1.1.2 Lifetime, State, and Messages
1.1.3 Clients of an Object
1.1.4 Separation of Interface from Implementation
1.2 Classes
1.2.1 State and Behavior
1.2.2 Method Overloading
1.2.3 Object Creation, Constructors, Garbage Collection
1.2.4 Method Invocation
1.2.5 Static Fields and Methods
1.2.6 Object References
1.3 Inheritance
1.3.1 Superclass and Subclass
1.3.2 Inherited and Specialized Fields
1.3.3 Constructors
1.3.4 Object Creation
1.3.5 Inherited and Specialized Methods
1.3.6 Method Overriding
1.4 The Object Class
1.4.1 The equals Method
1.4.2 The toString Method
1.4.3 The clone Method
1.5 Exceptions
1.5.1 Interpreting an Exception Message
1.5.2 Homegrown Error Handling
1.5.3 Throwing an Exception
1.5.4 Catching an Exception
1.5.5 Exception Class
1.6 Input and Output
1.6.1 Terminal-Driven IO
1.6.2 File-Based IO
1.6.3 String Tokenizing
1.6.4 Writing an Exception Class
1.7 Class Packages
1.7.1 Java Packages
1.7.2 Organizing Packages
1.7.3 Name Conflict Resolution
1.8 Access Control
1.8.1 Private Access
1.8.2 Package Access
1.8.3 Protected Access
1.8.4 Public Access
1.8.5 An Example
1.9 Polymorphism
1.9.1 Polymorphic Reference
1.9.2 Casting up the Class Hierarchy
1.9.3 Casting Down the Class Hierarchy
1.9.4 The instanceof Operator
1.10 Abstract Classes
1.10.1 Abstract Class Shape
1.10.2 Abstract Class Properties
1.11 A Game Park Example
1.12 Interfaces :
1.12.1 The Java interface Construct
1.12.2 Implementing an Interface
1.12.3 Interface as a Type
1.12.4 The Need for Interfaces
1.12.5 Extending Interfaces
1.13 Generics
1.13.1 Using java. uti 1 .ArrayLi st for Collections
1.13.2 The java. uti I. Ar rayLi st Public Interface
1.13.3 Implementing a Generic Class
1.13.4 Implementing a Generic Interface
1.13.5 Static Template Methods
1.14 Summary
1.15 Exercises
1.16 Programming Problems
2 The Big Picture
2.1 What Are Data Structures?
2.2 What Data Structures Do We Study?
2.3 What Are Abstract Data Types?
2.4 Why OOP and Java for Data Structures?
2.5 How Do I choose the Right Data Structures?
3 Efficiency of Algorithms
3.1 Polynomial Arithmetic: A Running Example
3.2 Basic Operations
3.3 Input Size
3.4 Asymptotic Growth of Functions
3.5 Order and Big Oh
……
4 Unordered List
5 Ordered List
6 Queue
7 Stack
8 Recursion
9 Binary Tree and General Tree
10 Binary Search Tree and AVL Tree
11 Heap
12 Hash Table
13 Sorting
14 Graphs I:Algorithms
15 Graphys II: Implementation
Index