+ 4

Can anyone tell briefly about class relationships in java..

8th Dec 2018, 3:12 PM
Shilpa Hipparagi
Shilpa Hipparagi - avatar
2 Answers
+ 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
9th Dec 2018, 8:11 PM
AKS
AKS - avatar
+ 1
Thank you
11th Dec 2018, 4:56 PM
Shilpa Hipparagi
Shilpa Hipparagi - avatar