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 the data types supported by java?
What is role of void keyword in declaring functions?
Can extern variables be initialized?
How do you know if a value is nan?
Explain about fail fast iterators in java?
What is the instance of an object?
Which are the two subclasses under exception class?
How to run a JAR file through command prompt?
What is the use of parse function in java?
What are the changes in java.io in java 8 ?
Can we have two main methods in a java class?
What is data type in java?
Explain access modifiers in java.
What do you mean by inner class in java?
How many digits can a float hold?