There are 2 classes, 1 LandAnimal and another WaterAnimal.
There is another class Animal which wants to have the
properties of both LandAnimal and WaterAnimal. How will you
design this situation?
Answer Posted / abdul
class WaterAnimal
{
// code
}
class LandAnimal extends WaterAnimal
{
//This class has WaterAnimal properties
}
class Animal extends LandAnimal
{
//This class has both LandAnimal and WaterAnimal properties
}
| Is This Answer Correct ? | 10 Yes | 9 No |
Post New Answer View All Answers
Explain the reason behind ending a program with a system.exit(0)?
What is regex in java?
Is integer immutable in java?
Explain thread in java?
What is synchronization and why is it important in java programming?
Can we use this () and super () in a method?
What are the 3 types of control structures?
Is a copy constructor?
Why enumeration is faster than iterator?
What is immutable state?
What is sizeof () operator?
Is there any limitation of using inheritance?
When should you use arraylist and when should you use linkedlist?
Explain wrapper classes in java?
What is a conditional statement explain with example?