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


Please Help Members By Posting Answers For Below Questions

What is args length in java?

660


What about interthread communication and how it takes place in java?

541


Why do you canvas?

606


What is the difference between a loader and a compiler?

522


What is the difference between preemptive scheduling and time slicing?

584






How to stop a thread in java? Explain about sleep () method in a thread?

578


What is the primitive type byte?

576


What are pass by reference and pass by value?

525


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

801


What is the syntax and characteristics of a lambda expression? Explain

537


Can a static class have a constructor?

515


What is thread start?

518


What is nan in java?

516


Why is it called boolean?

521


Similarity and difference between static block and static method ?

530