Tino APCS

Class Structure

Ignoring special cases, all classes have three sections:

  • Attributes - Variables that describe objects of this class
  • Constructors - Methods with the same name as the class used to initialize objects of this class
  • Methods - Code that defines the actions an object of this class type can perform

In order to distinguish classes from objects, class names should always begin with a capital letter. Objects should always begin with a lowercase letter.

Here is the general structure for a class:

public class MyClass {

    // Attributes

    // Constructors

    // Methods
}


Last modified: December 12, 2022

Dark Mode

Outline