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 each java object keep track of all the threads that want to exclusively access it?
In java how do we copy objects?
Explain creating threads by implementing runnable class?
How large is a boolean?
Why we override equals() method?
Which is the best approach for creating thread ?
What is purpose of find feature?
How many types of memory areas are allocated by JVM in java?
Define how can we find the actual size of an object on the heap?
What are the types of sockets in java?
What is immutability in java?
What is multithreading in java?
Which language is java?
Why is it called boolean?
What is the arraylist in java?