Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-10-2008, 05:37 PM
sivasayanth's Avatar
Member
 
Join Date: Dec 2007
Posts: 20
sivasayanth is on a distinguished road
what does it mean?
i read one document there is one paragraph

Quote:
""In the real world, you'll often find many individual objects all of the same kind. There may be thousands of other bicycles in existence, all of the same make and model. Each bicycle was built from the same set of blueprints and therefore contains the same components. In object-oriented terms, we say that your bicycle is an instance of the class of objects known as bicycles. A class is the blueprint from which individual objects are created.""
Quote:
we say that your bicycle is an instance of the class of objects known as bicycles


what does it mean? above quote? please help me
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-10-2008, 06:34 PM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
Example
Hello sivasayanth.

First, understand that:
  1. If we say that one object is an instance of a class then it means that the object has the same attributes and functionality as that class.
  2. Classes are usually expressed by making the first letter capital.
Try the following example:
Let's say we have a class called Animal. The class "Animal" has some attributes that gives it meaning and function. Now lets say that we have a "dog" and a "cat". Both are instances of the class "Animal". In Java it can be said:
Code:
Animal dog = new Animal("Ben", 3); Animal cat = new Animal("Jacky", 2);
Now "dog" and "cat" are similar in the sense that the are both instances of Animal. Now lets define the "Animal" class. Lets say that an Animal has a name and an age. The Animal class could be defined:
Code:
class Animal{ // Attributes private String name; private int age; // Behavior public void grow(){ age++; } // Constructor public Animal(name, age){ this.name = name; this.age = age; } }
You do not have to understand the code yet, but try to see it as "blueprints" for an Animal.

Do you understand now?
__________________
If your ship has not come in yet then build a lighthouse.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-10-2008, 06:34 PM
Member
 
Join Date: Jan 2008
Posts: 1
prash18 is on a distinguished road
latest front end updates in java,jsp
hi

i would like to learn front end developement using jsp
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 01-10-2008, 06:37 PM
Member
 
Join Date: Dec 2007
Posts: 5
beserie is on a distinguished road
Let's put it this way a class (Bicycles) is like a factory. Each time you press the button "constructor" you get an object (a bicycle) with has all the specification defined in the class. those a called instances of the class Bicycles.

hope this was enlightening. ;-)
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 01-10-2008, 06:43 PM
sivasayanth's Avatar
Member
 
Join Date: Dec 2007
Posts: 20
sivasayanth is on a distinguished road
Hello Tim and beserie

i got the idea. thanks a lot for your explanation
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +3. The time now is 01:41 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org