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
How we can generate random numbers in java?
What is variable and its types?
When does a class need a virtual destructor?
What about member inner classes?
What is hash code collision?
What is map and hashmap in java?
What is function declaration?
Mention some features of java?
How does map works in java?
What are design patterns and please explain?
What is the java idl system?
How can the checkbox class be used to create a radio button?
Is zero a positive integer?
What is the difference between JDBC 1.0 and JDBC 2.0?
What is static block?