IS method overriding is Duplication of Methods?
Answer Posted / venkat
To understand the Question, one needs to know the scenarios
where in a method is overriden.
there are two cases:
you want to override a method:
1)when the super class doesnt know how to implement it, and
leaves the implementation to the sub-class.
2)when the subclass feels, it has to add few more details
specific to itself than which are provided by the
superclass.
so there is no duplication happening provided one overrides
a method sensibly(understanding thorougly if overriding a
method is necessary or not).if one wishes to write things
that are already available, it is then called "duplication
of code",
| Is This Answer Correct ? | 11 Yes | 0 No |
Post New Answer View All Answers
What are streams?
Can we use String with switch case?
Why is a string immutable?
Can we declare an interface as final?
Why we use protected in java?
Can static methods be inherited?
What is the most important feature of java? What is an interface?
What is dynamic binding(late binding)?
How many types of methods are there?
Can a static class implement an interface?
What are java packages? What's the significance of packages?
What is the use of bufferedreader?
what is the purpose of using rmisecuritymanager in rmi?
Differentiate between static and non-static methods in java.
Can finally block be used without a catch?