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
Can we clone singleton object?
Does google use java?
What are abstract methods in java?
When does an object becomes eligible for garbage collection in java?
What is singleton class example?
What are the differences between this and super keyword?
Explain wait(), notify() and notifyall() methods of object class ?
Explain about abstract classes in java?
What is the final class?
What is command line argument
What is slash r?
How can an exception be thrown manually by a programmer?
give an example for encapsulation?
What is parameter example?
What is meant by data hiding in java?