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
why an outer class cannot be declared as private?
What is meant by null and void?
Are arrays passed by reference in java?
What is ide with example?
What is the syntax and characteristics of a lambda expression?
Can we serialize static variables in java?
Can you call a method in a method?
what do you understand by synchronization? Or what is synchronization and why is it important? Or describe synchronization in respect to multithreading? Or what is synchronization? : Java thread
Why are generics used?
What is the size of int?
What programs use java?
Can a constructor call another constructor?
What is the full form of jpeg?
Mention some features of java?
Does a class inherit the constructors of its superclass in java programming?