Classes, objects and methods
As Java is a pure object - oriented language, all java programs have at least a class.
Everything we want to represent through a Java program must be encapsulated in a class.
Classes define the state and behaviors for the basic component of a class known as objects.
Here the object - oriented refers that classes create objects and the objects uses the defined
methods for their mutual communication.
Since Java is an object-oriented language and therefore supports the following feature:
Class: A class is a user-defined data type which acts as a blueprint to represent the states
and behaviors for the corresponding objects.
Objects are instances of a class and have their own states and behaviors. For
example an object dog for an animal class has state as name, color, breed and behaviors as
eating, barking and wagging.
There are a number of objects in our surroundings which include dog, human, table, bird,
mobile , etc. All these objects have their specific states and behaviors.