Class in Java is the selection of similar types of object. From one class we can create n number f objects and n number of objects getting together to make a class.
A class is declared using class keyword.
Pro-grammatically class is nothing but a keyword which is used to declare any user-defined class.
It is the blueprint or skeleton of objects.
A class is a user-defined prototype from which objects are created.
Class can’t be physical.
The class is a logical entity.
Combining these language features into classes is known as encapsulation.
A class contains both data and code that operate on that data.
A class can contain 3 types of variable
The class is a logical container which never allocates any memory.
- In java point of view, a class is the collection of 4 types of member:-
Rules of class:-
- Never starts with a digit
- Space is not allow
- The keyword is not allow
- The symbol is not allowed except ‘ _ ’ and ‘ &’.
Int x=100; //datamember
Void show() //function
Static() //static block
Also Read:-Data member/Variable