Previous | Next | Trail Map | Learning the Java Language | Table of Contents


Objects and Classes in Java

In the lesson entitled Object-Oriented Programming Concepts(in the Writing Java Programs trail) you read about the concepts behind object-oriented programming. Now it's time to get to work and put those concepts to practical use in Java.

A Brief Introduction to Classes

To understand objects, you must understand classes. To understand classes, you need to understand objects. It's a circular process of learning. But you've got to begin somewhere. So, let's begin with two classes-- Point and Rectangle-- that are small and easy to understand. This section provides a brief discussion of these classes and introduces some important concepts and terminology.

The Life Cycle of an Object

Here, you will learn how to create a Rectangle object from the Rectangle class, use it, and eventually get rid of it.

Creating Classes

This section provides a complete description of a larger class, Stack, and describes all of the components of a class that provide for the life cycle of an object created from it. It talks first about constructors, then about member variables and methods, and finally about the finalize method.

Reality Break! The Spot Applet

This is the last section of this lesson, and it contains the code for a fun little applet. Through that applet, you will learn how to subclass another class, how to implement an interface, and how to use an inner class to implement an adapter.


Previous | Next | Trail Map | Learning the Java Language | Table of Contents