Is class an Object? Is object a class?

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


Please Help Members By Posting Answers For Below Questions

What is a functional interface? What is sam interface?

567


Can an interface inherit from another interface?

573


What is a nested interface?

587


What is the main use of message metaphor in object-oriented programming?

676


Define Destructor?

552






Does java support multiple inheritance? if not, what is the solution?

546


What is inheritance in java?

558


What is abstract method?

540


What are the types of polymorphism?

566


What are the Differentiate between abstraction and encapsulation.

491


What is a try/ catch block?

549


What are the limitations of inheritance?

541


What is bootstrap, extension and system class loader?

499


Can we have a default method definition in the interface without specifying the keyword "default"?

542


What's the order of call of constructors in inheritiance?

588