Objects are instances of class. We can say that object is variable of class type. Memory for instance declaration rather at the time of class declaration rather than time of object creation. Thus we can say that objects have physical existence and classes are only concepts.
Syntax:
[Access Modifier] className{
// body
}
Creating Object
Syntax:
[className] [objectName] = new [className]();
Program
123456789101112 class Demo{ void display(){ System.out.println("Class Example"); } public static void main(String args[]){ Demo obj = new Demo(); obj.display(); } }
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.