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
Explain the transient field modifier?
Differentiate between postfix and prefix operators in java.
What is the final access modifier in java?
When we serialize an object does the serialization mechanism saves its references too?
What are the types of web technologies?
Can I import same package/class twice?
What is a boolean used for?
Can we declare the static variables and methods in an abstract class?
what is the difference between process and thread? : Java thread
What is a condition in programming?
How do I stop concurrentmodificationexception?
What is a string what operation can be performed out with the help of a string?
What is treemap in java?
Can we make a constructor final?
Why do we use return statement?