Base Java language structure


1)Class


A class is a template that describes the data and behavior associated with an instance of that class.


A class is defined by the class keyword and must start with a capital letter. The body of a class is surrounded by {}.


package test;

class MyClass {

}

The data associated with a class is stored in variables ; the behavior associated to a class or object is implemented withmethods.


A class is contained in a text file with the same name as the class plus the .java extension. It is also possible to define inner classes, these are classes defined within another class, in this case you do not need a separate file for this class


2)Object


An object is an instance of a class.


The object is the real element which has data and can perform actions. Each object is created based on the class definition. The class can be seen as the blueprint of an object, i.e., it describes how an object is created.



Jay Kakadiya

Jay Kakadiya Creator

I am a computer field, & i am Web developer.

Suggested Creators

Jay Kakadiya