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

Why do people says “java is robust”?

564


Is it compulsory for a try block to be followed by a catch block in java for exception handling?

597


What is final keyword in java? Give an example.

580


What is difference between wait and notify in java?

549


What is the purpose of methodology?

641






What's the difference between an abstract class and interface in java?

565


What is final int?

535


Differentiate between a constructor and a method? Can we mark constructors final?

678


What are the types of sockets in java?

546


What is ‘has a’’ relationship in java?

727


What is a treeset in java?

549


Is heap stored in ram?

532


Explain OOPs concept.

653


What is arraylist e in java?

522


What is the meaning of flag day?

545