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
Is it possible to override the main method?
What is size_t?
What is the symbol for average?
What is meant by distributed application? Why are we using that in our application?
What is charat ()?
Is java a virus?
What are the various access specifiers in java?
Can private class be inherited in java?
Can vector have duplicates in java?
Can we have return statement in finally clause? What will happen?
why are wait(), notify() and notifyall() methods defined in the object class? : Java thread
What is java string pool?
Are the imports checked for validity at compile time? Will the code containing an import such as java.lang.abcd compile?
Define array. Tell me about 2-D array.
What is the difference between stream and buffer?