Object is a real world entity which can be created multiple times depending on the requirement. When an object is created a memeory is allocated. In Java object can be created in multiple ways including new keyword, newInstance() method, clone() method, factory method and deserialization.
Whereas class is a blueprint or template from which objects are created. It is a group of similar objects which is declared using class keyword. Class doesn’t allocate memory when it is created. A class can be defined using class keyword.
Author
Posts
Viewing 2 reply threads
You must be logged in to reply to this topic. Login here