Classes in java

In java a class is the blueprint from which individual objects are created.

Example

In objectoriented terms, we say that your bicycle is an instance of the class of objects known as bicycles

  • Java classes contain fields and methods. A field is like a C++ data member, and a method is like a C++ member function. In Java, each class will be in its own .java file
  • A method should be made static when it does not access any of the non-static fields of the class, and does not call any nonstatic methods

Creating a class:

Class <class name>
{
Member variables;
Methods;
}

Leave a Comment