Class

A class is a template for creating objects based on it. It defines:

  • What data can the object (fields) store?

  • What actions an object can perform (methods).

  • How objects (constructors) are created.

The class is created as follows:

public class Cell {

 // fields, methods, constructors of this class

}

• public - access modifier indicating that this class is accessible from any other class in any package.
• class - indicates that a class is being created.
• Cell - the class name

Important

The name of the class must match the name of the java file.

For example: MyClass.java ⭢ public class MyClass { … }