Results 1 to 5 of 5
Thread: what does it mean?
- 01-10-2008, 03:37 PM #1
what does it mean?
i read one document there is one paragraph
""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.""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:confused:
- 01-10-2008, 04:34 PM #2
Example
Hello sivasayanth.
First, understand that:
- 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.
- 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:
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:Java Code:Animal dog = new Animal("Ben", 3); Animal cat = new Animal("Jacky", 2);
You do not have to understand the code yet, but try to see it as "blueprints" for an Animal.Java 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; } }
Do you understand now? :pEyes dwelling into the past are blind to what lies in the future. Step carefully.
- 01-10-2008, 04:34 PM #3
Member
- Join Date
- Jan 2008
- Posts
- 1
- Rep Power
- 0
latest front end updates in java,jsp
hi
i would like to learn front end developement using jsp
- 01-10-2008, 04:37 PM #4
Member
- Join Date
- Dec 2007
- Posts
- 5
- Rep Power
- 0
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. ;-)
- 01-10-2008, 04:43 PM #5


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks