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
Why do people says “java is robust”?
Is it compulsory for a try block to be followed by a catch block in java for exception handling?
What is final keyword in java? Give an example.
What is difference between wait and notify in java?
What is the purpose of methodology?
What's the difference between an abstract class and interface in java?
What is final int?
Differentiate between a constructor and a method? Can we mark constructors final?
What are the types of sockets in java?
What is ‘has a’’ relationship in java?
What is a treeset in java?
Is heap stored in ram?
Explain OOPs concept.
What is arraylist e in java?
What is the meaning of flag day?