All Java programs use objects and the sort of an object is defined by its class or interface. Each Java program is described as a class and nontrivial programs typically include a number of classes and interface definitions.
A class is a collection of turfs that hold values and methods that operate on those values. Classes are the nearly all basic structural element of all Java programs. One cannot write a code in Java devoid of defining a class. All Java statements appear inside methods and all methods are implemented within classes.
A class describes a new reference type. An object is an instance of a class. A point class describes a type that is the set of all probable two-dimensional points. A point object is a value of that type: it signifies a single two-dimensional point.
Objects are typically created by instantiating a class with the new keyword and a constructor invocation, for example
Point p = new Point (1.0, 2.0);
A class definition contains a signature and a body. The class signature describes the name of the class and may also specify other significant information. The body of a class is a set of members with this in curly braces. The members of a class may take in fields and methods, initializers , constructors and nested types.
Members allowed either static or nonstatic. A static member belongs to the class itself while a nonstatic member is connected with the instances of a class. The signature of a class may state that the class extends another class. The extended class is famous as the superclass and the extension is known as the subclass. A subclass inherits the members of its superclass and may state new members or override inherited methods with new implementations.
The signature of a class may as well state that the class implements one or more interfaces. An interface is a reference type that defines method signatures but does not comprise method bodies to implement the methods. A class that implements an interface is wanted to provide bodies for the interface's methods. Instances of such a class are also instances of the interface type that it equipment.