+ 4
Can anyone tell briefly about class relationships in java..
2 Réponses
+ 9
Class is the blueprint of an Object and likewise, Object is an instance of a class.
What we define in a class determines what an object of that class would look like and what all things it would be capable of doing.
E.g) Let us take an example from our daily life.
If Human is a class, now we start defining our class,
Attributes - Nose , Ears, Eyes, Hands, Legs, Kidney, Liver, Lungs (to name a few)
Methods - Respiratory system, Cardiovascular system, Digestive system, Immune System (again few examples)
Now, each of these methods will use the attributes of its class to perform various functions defined in a human body.
So, we can say that this is the blueprint of our Human class.
If we create an instance of this class, let say Object O , then O will have all the attributes (Nose , Ears, Eyes, Hands, Legs, Kidney, Liver, Lungs) unique to it and will also have access to these methods to carry out this basic functionality.
Value of the attributes will define the state of the object. Also, class will not h
+ 1
Thank you