The JavaTM Tutorial

| Start of Tutorial > Start of Trail > Start of Lesson | Search Feedback Form

Trail: Learning the Java Language
Lesson: Classes, Interfaces, and Packages

## The Class Body

> The class body contains all of the code that provides for the life cycle of the objects created from it: constructors for initializing new objects, declarations for the variables that provide the state of the class and its objects, methods to implement the behavior of the class and its objects, and in rare cases, a `finalize` method to provide for cleaning up an object after it has done its job.

> Variables and methods collectively are called members.

> > Note: Constructors are not methods. Nor are they members.

> The `Stack` class defines one member variable in its body to contain its elements--the `items` `Vector`. It also defines one constructor--a no-argument constructor--and three methods: `push`, `pop`, and `isEmpty`.

| Start of Tutorial > Start of Trail > Start of Lesson | Search Feedback Form