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

@ Bhaskr Reddy

The only problem I see with your solution is when I want to create the object Animal which has to implement properties from both WaterAnimal and LandAnumal: How will I create an instance of of class Animal which implements both the interfaces at the same time?

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain with example the concept of constant variable in java.

640


Can a final variable be initialized in constructor?

492


Can we make main() thread as daemon?

581


What are unchecked exceptions in java?

617


What is a null point?

559






What is a parameter in java?

550


Can we use synchronized block for primitives?

608


Explain the private field modifier?

613


What happens if we override only equals?

585


Is java owned by oracle?

528


Which arithmetic operations can result in the throwing of an arithmeticexception?

601


Write a java program that prints all the values given at command-line.

559


what is a thread pool in java and why is it used?

534


When a thread is executing synchronized methods , then is it possible to execute other synchronized methods simultaneously by other threads?

573


Why there are some null interface in java? What does it mean?

649