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
How is treeset implemented in java?
What is flag in python?
How much ram can a 64 bit processor theoretically?
Is java a compiler?
Is an empty arraylist null?
how to deploy apache tomcat server to weblogic server in java
Explain about the dynamic behavior of core java?
Can we use string in the switch case?
What does sprintf mean?
There are two classes named classa and classb. Both classes are in the same package. Can a private member of classa can be accessed by an object of classb?
List some important features of java 10 release?
Can a vector contain heterogenous objects?
What do you mean by global variable?
Can static methods be inherited?
What is space character in java?