What is difference between instance and object.?what are the all difference between interface and abstract class?

Showing Answers 1 - 50 of 50 Answers

Girish Gajwani

  • Oct 24th, 2005
 

instance means just creating a reference(copy) .

object :means when memory location is associated with the object( is a runtime entity of the class)  by using the new operator

interface is a set of abstract methods, all of which have to be overriden by the class whichever implements the interface

abstract class is a collection of data and methods which are abstact  (not all of them)

Debasankar Sinha

  • Oct 27th, 2005
 

Question: what is difference between instance and object.?
what are the all difference between interface and abstract class?

  Was this answer useful?  Yes

Mallaiah_Papinni

  • Oct 28th, 2005
 

Hi,

  Instance refers to the copy of the object at a particular time whereas object refers to the memory address of the class.

  Was this answer useful?  Yes

prafulla

  • Nov 2nd, 2005
 

Interface supports runtime polymorphism,but abstract class doesn't.

All methods in interface have no defination, only declarations.But abstract class have methods with defination.

  Was this answer useful?  Yes

Ravi

  • Nov 2nd, 2005
 

I think that abstract classes too support run-time polymorphism for the methods that are abstract within them. For such a case, the abstract class and interface provide similar functionality.

  Was this answer useful?  Yes

sushi

  • Nov 5th, 2005
 

if i declare any fields in the classi.e not in any methods...they r given a default value,i.e for int its zero(0)..these are instance fields..........an object is an instance of a classi.e the object created is of the class type.

          well, in an interface you can only define the prototype of the methods,it cant contain any implimentations,while in an abstract class there can be absract methods and also implimentations of the method which are not abstract

  Was this answer useful?  Yes

mandyjoshi

  • Nov 11th, 2005
 

Object is instance of a Class.

All variables of interface are by default static, final. Interface can not have implemented methods. All methods are by default abtract.

Abstract class should have at least one abstract method, other methods can have implementation.

  Was this answer useful?  Yes

praveen

  • Nov 14th, 2005
 

Girish Gajwani Wrote:

instance means just creating a reference(copy) .

object :means when?memory location is associated with the object(?is a runtime entity of the class)? by using the new operator

interface is a set of abstract methods, all of which have to be overriden by the class whichever implements the interface

abstract class is a collection of data and methods which?are?abstact? (not all of them)


Amar Jagdale

  • May 30th, 2006
 

Instance referes to Reference of an object.

Object is actaully pointing to memory address of that instance.

we can implement more than one interface.But We cannot extend more than one Abstract Class.

  Was this answer useful?  Yes

Raj kumar

  • Apr 11th, 2007
 

The main difference between abstract class and interface is,


1. Abstract class has the constructor, but interface doesn't have.
2. Main reason is abstract class contain the instance variable, that why it has
the constructor, where as interface has only constants (final variables and
ABSTRACT METHODS).
3. A class which can implement the interface, is not implement all methods which
are declared in interface , such class is declared as abstract class. that mean
abstract class is a subtype of an interface.


This is my conclusion. If you have an queries let me know.

  Was this answer useful?  Yes

phaneendra

  • Aug 16th, 2007
 

Instance in Java does not have any class defination, whereas object stored in the heap will be having the class defination
eg:
String hello---->object

int[] i----->reference

  Was this answer useful?  Yes

Ram

  • Nov 5th, 2007
 

main()
{
new BackEndRequest();
{
   BackEndDataRequest BER = new  BackEndDataRequest("aName","atype","aDataSrcObjRef");
   BackendInputParam BIP =new BackendInputParam("name","type");
}
vector v=new vector();
StringBuffer sb=new StringBuffer().append(BER).append(BIP).toString().
{
 v.add= "BER" + "BIP";

 for(i=0;i<=v.size;i++)
}

  Was this answer useful?  Yes

Instance is a the actual object created at runtime.
Objects are key to understanding object-oriented technology. Look around right now and you'll find many examples of real-world objects: your dog, your desk, your television set, your bicycle.

Real-world objects share two characteristics: They all have state and behavior.
object is Dog.
State-  name,color,bread and hungry.
Behavior- barking, tail,fetching.

  Was this answer useful?  Yes

ngprasad.2

  • Jun 13th, 2008
 

object is an instance of a class which holds reference/address of its location
where as instance holds da copy of its reference

  Was this answer useful?  Yes

sonal.dave

  • Feb 25th, 2010
 

There are some differences like..
Class A {}
A obj1; //this is the object declaration without occupy any memory..
A obj2 = new A(); //this is the object instance with occupy memory for this..

  Was this answer useful?  Yes

Let me explain u more concisely,

Here instance means instance of the class not the object

Taking the above example itself given by Sonal, Like if u r defining like this
ClassA obj1; then u r declaring an object but here the object is declared but does not occupy any memory

ClassA obj1 = new ClassA(); This means u r creating an instance of the class,
means now some memory is occupied by the object.

  Was this answer useful?  Yes

raja

  • Sep 17th, 2011
 

every object can be a instance but not vice versa........instance means allocating sufficient memory to the variables of the class

  Was this answer useful?  Yes

Ashutosh Das

  • Sep 20th, 2011
 

Instance is just a reference variable and object is created through memory allocation of a class with new operator.

In Interface all the methods are public and abstract and all the variables are public static final.

When any class does not override all the methods of Interface that class must be abstract.

In abstract class, at least one method must be abstract.

  Was this answer useful?  Yes

Pratik Telaviya

  • Sep 22nd, 2011
 

You can have concrete method in abstract class while it is not possible in interface.There is only declaration of methods in interface.

  Was this answer useful?  Yes

Hari

  • Oct 12th, 2011
 

There is not much more difference between interface and abstract class , but few differences are: we can not create Contractor of interface but we can create contractor of abstract class , there is some implementation of method in abstract class but we can define implementation in interface, we can just implement interface in there base class. Abstract class can inherit from other classes , interface can inherit only interface. Abstract class can contain fields , interface do not have states.
Thanks

  Was this answer useful?  Yes

heena

  • Feb 15th, 2012
 

Object is a instance of a class. Instance is the occurence of the object of class which defines its state and behavior.

  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