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 are inbuilt functions?
Explain wait() method of object class ?
What are the types of methods in java?
What is a lock or purpose of locks in java?
In java, how many ways you can take input from the console?
What is a lightweight component?
When is the finally clause of a try-catch-finally statement executed?
I want to print “hello” even before main is executed. How will you acheive that?
What is serial version uid and its importance in java?
What is static and final keyword in java?
What are latest features introduced with java 8?
Can we pass null as argument in java?
What is empty string literal in java?
Explain the importance of thread scheduler in java?
What is the significance of continue jump statement? Explain with an example.