Next:
Introduction
Up:
Elements of Object-Oriented Program
Previous:
Elements of Object-Oriented Program
From Scheme to Java
Subsections
Introduction
What is an Object?
Java Mechanics
Notation and Syntax
Java Expressions
Precedence of Operations
Java Statements
The Structure of Java Programs
Printing Object Values
Defining Constants
Capitalization and Commenting Conventions
Java Data Types
Primitive Types
Object Types
Java Class Definitions
Defining Classes to Represent Compound Data
Constructors
Defining Instance Methods
The Union and Composite Patterns
Member Hoisting
The Composite Pattern
Defining Instance Methods for a Composite Class
Conditional Statements
Blocks
Singleton Pattern
Basic Program Design
The Design Recipe
Data Analysis and Design
Contract and Header
Examples
Template
Body
Test
An Extended Example: Lists
Type Predicates and Type Casts in Java
A Sample IntList Program
Inheritance and the Composite Pattern
Overriding
equals
Helper Methods, Packages, and Visibility
Unit Testing in Java
Tests Should Check Themselves
Tests Should be an Integral Part of the Coding Process
Write The Tests First
Unit Testing and JUnit
Conclusion
Interfaces
Multiple Inheritance
Implicit Polymorphism
Interface Types
Using Classes and Interfaces to Enforce Invariants
The Command Pattern
Static Members of Classes
Complete Java Programs
A Complete Java Program
Loose Ends
Local variables
Casts and Static Type Checking
Exceptions as Errors
Name and Method Overloading
The Visitor Pattern
Interpreting Arithmetic Expressions
Openness in Data Design
Polymorphic Visitors
Polymorphic Visitors with Arguments
Unusual Situations versus Runtime Errors
A Motivating Example
Using Java Exceptions
Exception Handling
Corky Cartwright 2004-02-05