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 are decalarations?
Can a function return a function?
What do u mean by variable?
Can we change the scope of the overridden method in the subclass?
What is linkedlist in java?
What is a static method in java?
What methods are used to get and set the text label displayed by a button object?
What is lastindexof in java?
What is oops in java?
When do we need to use internal iteration? When do we need to use external iteration?
How destructors are defined in java?
Why do we use string?
What is java in layman terms?
What are the 6 functions?
What is a pointer and does java support pointers?