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 / vikneswarank

class LandAnimal
{
//some code here

}
class WaterAnimal extends LandAnimal
{
//soma code here
}
class Animal extends landAnimal
{
// here we can access properties both class
}

Is This Answer Correct ?    2 Yes 19 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When should I use singleton pattern?

549


Is it possible to override private or static method in java?

550


Mention some interfaces implemented by linked list in java.

545


What is difference between next () and nextline () in java?

543


What is difference between add() and addelement() in vector?

1071






define polymorphism in java

641


How do you sort a string in java?

541


What does flagged out mean?

576


Explain about class in java?

614


Is a class subclass of itself?

608


Does substring start with 0?

560


Why enumeration is faster than iterator?

531


What is the full name of java?

573


How do you read a char in java?

465


Which package is always imported by default?

551