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 does the string method compareto () do?
Which collection does not allow duplicates in java?
What are the uses of java?
What is an empty class? What functionality does it offer in Java?
Explain the difference between association, aggregation and inheritance relationships.
What is an immutable object?
What is the difference between hashmap and hashtable? What is an interface?
Explain the use of javap tool.
What are the advantages of java over cpp?
What are peerless components in java programming?
What is null statement?
Which eclipse is best for java?
In java, how many ways you can take input from the console?
How can we make string upper case or lower case?
What are 5 boolean operators?