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 / suganya from tamilnadu
class Animal
{
// code
}
class LandAnimal extends Animal
{
//This class has WaterAnimal properties
}
class WaterAnimal extends Animal
{
//This class has both LandAnimal and WaterAnimal properties
}
| Is This Answer Correct ? | 1 Yes | 4 No |
Post New Answer View All Answers
What about interrupt() method of thread class ?
What are multiple inheritances? Is it supported by java?
What is the size of boolean variable?
What is a predicate method?
Can we have return statement in finally clause? What will happen?
What is local declaration?
What is an escape character in java?
Explain how can you debug the Java code?
What is the difference between abstract classes and interfaces?
How do I start learning java?
What do you mean by formatting?
Differentiate between vector and array list.
Which is better list or arraylist in java?
What are the two environment variables that must be set in order to run any java programs?
What is singleton class in ruby?