|
A Java class is like a blueprint for the similar kinds-of Java objects. It’s a ‘specification’ from which many Java objects can be created. Since each Java object needs to store its state and implement its behavior, this specification needs to declare –
Where the state will be stored?
How the behavior will be implemented?
The Java class makes the provision for storing object’s state in member variables and implements the object’s behavior in methods. Naturally, the Java syntax for declaring a class constitutes member variables and methods. Let us take a look at the syntactic details of the class declaration with an example.