Answer Posted / murthy
A class is neither an object nor an object is a class.
A class is like a blue print for an object.
An object is an instance of a class.
Some people have given the right examples above and some
more goes here:
You can consider a blue print for your house is a class.
You cannot stay in blue print :).
The building built based on the blue print is called an
object. You can stay in it.
Class should be treated like a "data type" and an object
like a instance of that datatype.
for e.g., int i; you can considet int as a class and i as
an instance of an object.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is a functional interface? What is sam interface?
Can an interface inherit from another interface?
What is a nested interface?
What is the main use of message metaphor in object-oriented programming?
Define Destructor?
Does java support multiple inheritance? if not, what is the solution?
What is inheritance in java?
What is abstract method?
What are the types of polymorphism?
What are the Differentiate between abstraction and encapsulation.
What is a try/ catch block?
What are the limitations of inheritance?
What is bootstrap, extension and system class loader?
Can we have a default method definition in the interface without specifying the keyword "default"?
What's the order of call of constructors in inheritiance?