Object of Java, BlueJ Edition, The

David D. Riley  
Total pages
November 2002
Related Titles


The Object of Java fully embraces the object-oriented paradigm by taking an objects-centric approach to presenting problem solving and programming. Readers begin with four complete chapters focusing on objects, classes and methods. The presentation of primitive data occurs in Chapter 5, ensuring the necessary prior exposure to object declaration, object instantiation, assignment, method calling, parameter passage, class diagrams and object diagrams. The topics of aggregation and inheritance occur earlier than in many other CS1 books. In order to accommodate this placement of topics, control structures are covered later than in other books. Through many semesters of class-testing this objects-centric approach, students have developed a high degree of competence with both object-oriented features and the “classic” language features such as numeric expressions and control structures.

This book focuses on the skills and disciplines of software engineering that are needed for good programming. Since specifications are critical for conveying code behavior in the object-oriented model, discussions of method preconditions and postconditions, and class invariants are used consistently to document examples and to define example classes. The Unified Modeling Language is used extensively as the specification language. The book also uses the notion of patterns to identify numerous expressions, instructions, algorithms and designs that serve to pattern program segments.

This BlueJ version integrates the use of BlueJ throughout the presentation. Explanation of BlueJ facilities for programming, testing and debugging are included along with these topical discussions. An appendix that demonstrates key BlueJ features is also included.


  • Integrates the use of BlueJ throughout the book.
  • Presents Java by using “objects throughout” to get students immersed in an object-oriented mindset.
  • Emphasizes the Software Engineering skills necessary to be a good programmer.
  • Software Engineering Hint boxes offer a collection of software developer “best practices” such as how to format a language construct for good programming style, or the way that good programmers approach a common design problem.
  • Instills the importance of specification by making extensive use of preconditions and postconditions.
  • Uses the Unified Modeling Language (UML) for all diagramming notation. Using UML diagrams expose students to the same notations that have now become standard in the software development industry.
  • Highlights commonly used patterns in many expressions, instructions, algorithms, and designs inside rectangles so that the reader may become familiar with a commonly-required solution and learn how and when it is applicable.
  • Features the importance of testing by devoting special sections to ensure that readers develop basic debugging skills, and knowledge of simple path testing and black-box testing.
  • The Java Inspector boxes in each chapter provide practical “how to” ideas of what to check, review, and walk-through before completing a program and also serve as a review of important material from the chapter.

Table of Contents

1. Objects and Classes.

Objects Everywhere.

Objects in Software.

Anatomy of a Software Class.

The Difference Between Objects and Classes.

Edit, Compile and Run.

Programming with BlueJ.

Introduction to Software Engineering.

A Sample of Object-oriented Software Development.

2. Introduction to Java Objects.

Syntax Diagrams.

The Method Call.

Instruction Sequences.

Constructing and Assigning Objects.


Putting it Together in a Java Class.

Programming by Contract.


BlueJ Debugging.

3. Introduction to Design & Implementation.

Top-down Design — Refining Algorithms.

Selecting Identifiers.

A Second Design Example.

A GUI Software Library.

Calling Methods with Parameters.

Import Declarations.


Debugging with BlueJ and System.out.println.


4. Methods.

The Need for a Subprogram.

Private Parameterless Methods.

Using Parameters.

Local Variables.

Non-void Methods.

Debugging Methods.


Introduction to Event Handling.

Postcondition Notation.

A Design Example Using AView.

5. Numeric Processing.

Primitive Types.

Primitive Integer Data Types.

Differences Between Primitives and References.

Real Numbers ( float and double types).

System.out.println Revisited.

Mixed Type Numeric Expressions.

Primitive Methods (including Math).

Constants ( final).

6. Supplier Classes.

Clients and Suppliers in Software.

Another Client.


Manipulating Suppliers with BlueJ.

Scope and Lifetime.

Class Interface Design Principles.

Separating Read and Write Access.

Method Overloading.

char Data Type.


ALabel (optional).

7. Logic and Selection.

The if Instruction.

Relational Expressions.

Boolean Expressions.

Conditional Evaluation.


Nesting if Instructions.

Multi-way Selection.

The switch Instruction.

Software Testing.

Logic and Programming (optional).

Assertions (optional).

8. Inheritance.


Class Relations: contains_a and is_a.

Specialization and Extension.

protected Scope.

Inheriting for Event Handling.

Animating by Inheriting EventTimer (optional).

Design Example with Scrollbars and Text Fields (optional).


9. Inheritance Hierarchies and Polymorphism.

Inheritance Hierarchies.

Type Conformance.

Subtype Polymorphism.

Abstract Classes.

The Object Class.

Equality by Content and by Identity.

10. Repetition.

The while Loop.

Counting Loops.

Sentinel Loops.

Loop Design Cautions.

Nested Loops.

The do loop.

Loop Invariants.

Looping and Event Handling.

Testing and Loops.

11. Containers.

Containers of Objects.

Generic Containers.

Type Safety, Casting, and instanceOf.

Wrapper Classes.


List Traversal.

Linear Searching.

Sorting by Insertion.

12. Introduction to Arrays.

One-dimensional Arrays.

Keeping Indices in Bounds.

Sequential Processing with for Loops.

Treating Arrays in Aggregate.


Arrays of Objects.

Arrays and Objects.

Sorting — The Selection Sort.

Two-dimensional Arrays.

13. File Input and Output.


The Java File Class.

I/O Exceptions.

Input and Output.

DataInputStream and DataOutputStream.

Text Files.

Terminal-style I/O.

Persistent Objects (optional).

JFileChooser (optional).

14. Recursion.

Recursive Definition.

From Recursive Definition to Method.

Recursive Methods.

Recursive Execution.

Recursion and Repetition.

More Complicated Forms of Recursion.

15. Library Issues: Packages, Statics, Applets & Delegation.

Creating Packages.

Using Packages.

static Methods.

static Variables.

Applications and Applets.

Event Delegation (optional).


A. Intro to Computing Systems.

What is a Computer?

Analog or Digital?

How is Data Stored?

What are Binary Numbers?

How do Computers Communicate?

Why are Computers Called “Systems”?

B. Syntax Diagrams for Java.

C. Java Operator Precedence.

D. swing, awt & aLibrary.

Background on awt and swing.

Transitioning Common Features.

JFrame instead of Awindow.

JLabel instead of Alabel.

JComponent instead of AView, AOval, ARectangle and AroundRectangle.

JComponent instead of Aline.

JComponent instead of Aimage.

Event Delegation - Handling Mouse Events.

JButton instead of Abutton.

JScrollBar instead of Ascrollbar.

TextArea instead of AtextArea.

JTextField instead of AtextField.

E. UML Notations.

Class Diagrams.

Object Diagrams.

Activity Diagrams.

F. BlueJ Summary.

Installation and Configuration.

Working with Projects.

Working with Classes.

Testing and Debugging.

Instructor Resources