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
I want to persist data of objects for later use. What is the best approach to do so?
What are the different types of inner classes?
Can we call the run() method instead of start()?
Explain the use of javap tool.
What is meant by data hiding in java?
What are class types in java?
What is a finally block? Is there a case when finally will not execute?
What is int argc char * argv?
Is it necessary that each try block must be followed by a catch block?
What is encapsulation in java?
How many days will it take to learn java?
What is the function of java?
What does \ mean in regex?
How do you define a set in java?
What are the 4 types of research methods?