aspose file tools*
The moose likes Beginning Java and the fly likes Explain instance in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Explain instance in java" Watch "Explain instance in java" New topic
Author

Explain instance in java

Rajendra Prakash
Ranch Hand

Joined: Sep 10, 2009
Posts: 293
Hi Friends, can you explain instance in java. In general instance means "occurence of something" . In java what is instance.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9313
    
  17

Please take time to Carefully Choose One Forum when you start a topic. The servlet forum is for servlet questions. I'll move it to the appropriate forum...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11473
    
  16

in java, an instance is an occurrence of the object.

Someone writes a java file to define a class. This is like a blueprint on what the object looks like and what it does.

Just like you can use the same blueprint over and over to build the same house many times, you can do the same thing with a class. you can make many instances, each of which live in their own place independently of each other.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39773
    
  28
Welcome to JavaRanch

Useful answer, but it would have been easier to read with the CODE button. As you are new, I have edited your post.
s.palanivel rajan
Ranch Hand

Joined: Sep 22, 2009
Posts: 41
hi
instance is nothing but the object of the class...
we can create any no of instance per class..
for example...
a blue print of the cycle will be a class and a single cycle will be the instance...


With Regards,
S.Palanivel Rajan B.E.
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

If you think of a class as a data structure or a type definition. You can think of instance as a snap shot that shows you what values each of the constituent elements of that data structure have at a particular time.

If class is an abstraction. An object is concrete implementation.
For e.g: Chair is an abstraction(an idea).It is intangible. A revolving chair is an implementation of the idea. It is tangible.


[List of FAQs] | [Android FAQ] | [Samuh Varta]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39773
    
  28
Better to say "chair" is abstract, and "a red chair" is concrete. "Revolving chair" would be a subtype of "chair".
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

Campbell Ritchie wrote:Better to say "chair" is abstract, and "a red chair" is concrete. "Revolving chair" would be a subtype of "chair".


My mistake.

Yes, color would be an attribute;"Red" is the color that the chair instance has. "Revolution" is a functionality so subtyping would be a better fit to describe it.

Thanks CR!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Explain instance in java