Previous | Next | Trail Map | Writing Java Programs | Java Objects


Creating Your Own Class

A class is a template used to create many different objects. It is convenient to think of a class as a data type. Indeed, objects created from the same class are often spoken of as being of the same type. In your Java programs you can use classes provided by other programmers, such as the classes provided by the Java development environment. Or you can write your own.

The implementation of a class is comprised of 2 components: the class declaration and the class body.

class declaration {
    . . .
    class body
    . . .
}

Writing a Method
  • Declaring a Member Variable

  • Previous | Next | Trail Map | Writing Java Programs | Table of Contents