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
What is finalize() function in java?
What is continuity of a function?
What is the covariant return type?
What about interrupt() method of thread class ?
Should you use singleton pattern?
What is run time allocation?
Is list thread safe in java?
Which class is used by server applications to obtain a port and listen for client requests?
What is contractor means and methods?
What is a method header?
What is the difference between final, finally and finalize()?
What about method local inner classes or local inner classes in java?
What is difference between final and immutable?
What is class array in java?
What does the “static” keyword mean? Can you override private or static method in java?