What is the difference between an instance and an object in Java?

Questions by maharamesh87

Showing Answers 1 - 12 of 12 Answers

sanjay

  • Sep 25th, 2007
 

Instance in java...

An actual object of a particular class. An instance of a class is created using the new operator followed by the class name.

Object in java...

When we define a class that does not extend any other class, it implicitly extends java.lang.Object. Also, an anonymous class based on an interface.

  Was this answer useful?  Yes

AjayMukiri

  • Apr 30th, 2008
 

Instance and Object are same as per my knowledge

Creating an Instance of a class is creating an object only

A a = new A() --Here "a" is an instance of a class A, on same time "a" is an object of Class A. 

or

In the other way for creating Instance we use new operator, for Object creation also we use new operator. (There are other methods also with which we can create object/instance of a class for a while the above criteria is an eg,.)

  Was this answer useful?  Yes

raghavleo

  • Jul 4th, 2008
 

In general we think instance and objects are same, but they are incorrect.

instance will have the both class definiation and the object defination where as

in object it will have only the object defination.

i think this is the correct with my knowledge.

Generally people think object is an instance of class but we can't take this one for

the above answer and they both are different.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions