Java Class and Object

 

Class

1.It is a collection of data members and member functions.
2.Data members are the variable used inside class.
3.Member functions are the function used to perform a task.
4.It is also called Userdefined data type.

Syntax of class


Object

Object is real world entity . with the help of object we can access member variables and member functions of class. Object is also used to allocate the memory for class.

Syntax of Object

  Class_Name object_Name = new Class_Name();

Ex. 

     Demo obj = new Demo () ;

Post a Comment

0 Comments