aspose file tools*
The moose likes Beginning Java and the fly likes what is diff betwn object and instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what is diff betwn object and instance" Watch "what is diff betwn object and instance" New topic
Author

what is diff betwn object and instance

ganesh pol
Ranch Hand

Joined: Apr 29, 2005
Posts: 151
what is diff betwn object and instance

i have seen in many books object and instance are used interchagebly what is subtle diff betwn object and instance
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
It's safe to say an object is an instance or instantiation of a class. "instance" is used in more ways than this, so object and instance aren't quite equivalent, but they're close enough for most conversations.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Terry Rickson
Greenhorn

Joined: May 05, 2005
Posts: 22
Hi,

If you look at this code.

Button b = new Button();

It creates a button object but the variable b is the instance variable of the Button object.

Hope this helps!
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
that was my first thought too, but i guess Stan is right: what OP means is instance like when you use the new keyword - you instantiate something


java amateur
L�szl� Kov�cs
Greenhorn

Joined: Jun 18, 2005
Posts: 17
Originally posted by Terry Rickson:
Button b = new Button();

It creates a button object but the variable b is the instance variable of the Button object.


Surely b is a reference to the created object, and that object is an instance of the Button *class*?


Disclaimer: The above post may or may not reflect reality as seen by other people.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Originally posted by Terry Rickson:
H
It creates a button object but the variable b is the instance variable of the Button object.


Sorry, but that's incorrect terminology. An instance variable is a member variable of an object, used in contrast to class or static variable. "b" is a variable that refers to an object; that object is an instance of Button. But based on that one line of code, we can't tell if "b" is an instance variable or a local variable.


[Jess in Action][AskingGoodQuestions]
sreedhara satuluri
Greenhorn

Joined: Mar 17, 2005
Posts: 12
the simple explanation is that....we declare a class and hence we need to declare that class into the main program..

The name of the class is object and the variable declared is the instance of the object



if any other answers then please let me know
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Originally posted by sreedhara satuluri:

The name of the class is object and the variable declared is the instance of the object


I think we've answered this one well enough now. These subsequent answers are just confusing (and generally wrong.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is diff betwn object and instance