Any body please explain me uses- of relation ship in java?
IS-A relationship is the relationship between an object and its own class/super class. It can be checked using instanceof operator.
HAS-A relationship occurs when a class holds another class's reference/object, this is known as composition/aggregation.
Both enhances code re-usability by providing their class content availabe to other classes.
I beleive that is an example of composition.what if a class is inheriting the properties of another class is it not usage of relationship.
Is a relationship is the relationship between the child and parent class
Has a relationship is using another class in your class by making its object
How ans comes to 10
Hey sush , what's the hell are you talking . ....
If a class contains an object of another class then it is called as has-a relationship... Using is-a and has-a relationships we can achieve reusability
If a class inherited from another class then it will be called as is-a relationship
It no concept of relationship but we can defain using inheritance.using inheritance we can access data of onther call of data and data member