134.117.1.60 writes:
Hi,
Question: Could someone give me much detailed information on Class, Object and Instance? In my opinion, Object is the same to the Class. I am a bit confused with the relationship among the three.
I am quite new to JAVA and OOP. Thanks a lot for your help!
Regrads
Leo
:~::~::~::~::~::~:
202.61.245.68 writes:
An object and a Class are logically equivilant. In practice, a class is the prototype for an object, while an instance is a particular incarnation of the object.:~::~::~::~::~::~:
Avi Chapman
194.158.187.242 writes:
A class is similar to what you learned in highschool about classification of animals.
Examples of classes are: mammels, elephants, humans. Classes describe the common properties and behaviour. E.g.
- It is common for elepahnt to have a trunk.
- Humans have a sence of humour
- Mammels have lungs to breath with
Classes have hierarchy. Both elephants and humans are subclasses of mammals, but not vice versa.
An Object (or intstance, same thing) is one 'living' example, something you can smile at. It is something with a name, that eats, to wich you can talk: the elphant Dombo for example, or "Henk Jan, hjnoot@sum-it.nl" who is human. Object always have one class. I myself am human, and can't be of class Elephant at the same time.
Several objects can have a common super class, somewhere in the class hierarchie. E.g. both Dombo and Henk Jan are also mammals, because that is a common super class.
In Java you will create a class with a new source file, and your application will create instances (objects) of that class. In Java, object can receive messages, e.g. the message smile().
you.haveFunWithJava();
Best regards,
Henk Jan:~::~::~::~::~::~: