What is the is a and has a relation ship in oops concept in
java?
Answer Posted / b venkat reddy
The "is a" relationship is expressed with inheritance and
"has a" relationship expressed with composition.
Both inheritance and composition allow u to place sub-objects inside your new class.Two main techniques to code reuse are inheritance and composition.
Ex.: IS A ===>> house IS A building
class House {
.....
}
class Building extends House{
......
}
Ex.:HAS A ===>> house HAS A bathroom
class House {
Bathroom b = new Bathroom();
}
Is This Answer Correct ? | 22 Yes | 5 No |
Post New Answer View All Answers
what is the role of xml in core java?? and how we can use it?? can somebody give a sample program with explanation and from where i can read more about xml?????
What are the steps involved to write rmi based programs?
What is the difference between a constructor and a method?
A person says that he compiled a java class successfully without even having a main method in it? Is it possible?
Can a variable be local and static at the same time?
explain what is transient variable in java?
What will happen if there is a default method conflict as mentioned above and we have specified the same signature method in the base class instead of overriding in the existing class ?
What is meant by method?
What is try-with-resources in java?
What is collection sort in java?
What is flag in java?
what is optional in java 8?
Which collection is sorted in java?
List down the methods and interfaces of collection class in java.
Tell some latest versions in JAVA related areas?