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
define polymorphism in java
What happens when you add a double value to a string?
What is an error in java?
What is a databasemetadata?
What are recursive functions? Give some examples?
What are the main uses of this keyword?
How can I become a good programmer?
Define packages in java?
What is constructor and its types?
What does n mean in java?
What is the default execution method in java?
What is procedure writing?
Is empty in java?
Write code of any action class?
What are the disadvantages of using inner classes?