whats is inheritance?

Answer Posted / mukthiyar

Inheritance is a Reusable of the existing code.

There are two types of Inheritance implementation
Inheritance and interface Inheritance.

Implementation inheritance promotes reusability but improper
use of class inheritance can cause programming nightmares by
breaking encapsulation and making future changes a problem.
With implementation inheritance, the subclass becomes
tightly coupled with the superclass. This will make the
design fragile because if you want to change the superclass,
you must know all the details of the subclasses to avoid
breaking them. So when using implementation inheritance,
make sure that the subclasses depend only on the behavior of
the superclass, not on
the actual implementation.

Interface inheritance promotes the design concept of program
to interfaces not to implementations. This also reduces the
coupling or implementation dependencies between systems. In
Java, you can implement any number of interfaces. This is
more flexible than implementation inheritance because it
won’t lock you into
specific implementations which make subclasses difficult to
maintain. So care should be taken not to break the
implementing classes by modifying the interfaces.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is finalize() function in java?

563


What is continuity of a function?

528


What is the covariant return type?

584


What about interrupt() method of thread class ?

590


Should you use singleton pattern?

528






What is run time allocation?

579


Is list thread safe in java?

494


Which class is used by server applications to obtain a port and listen for client requests?

496


What is contractor means and methods?

561


What is a method header?

550


What is the difference between final, finally and finalize()?

548


What about method local inner classes or local inner classes in java?

561


What is difference between final and immutable?

563


What is class array in java?

517


What does the “static” keyword mean? Can you override private or static method in java?

637