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


Please Help Members By Posting Answers For Below Questions

Can each java object keep track of all the threads that want to exclusively access it?

533


In java how do we copy objects?

548


Explain creating threads by implementing runnable class?

585


How large is a boolean?

551


Why we override equals() method?

559






Which is the best approach for creating thread ?

718


What is purpose of find feature?

607


How many types of memory areas are allocated by JVM in java?

588


Define how can we find the actual size of an object on the heap?

650


What are the types of sockets in java?

538


What is immutability in java?

600


What is multithreading in java?

545


Which language is java?

538


Why is it called boolean?

521


What is the arraylist in java?

526