IS method overriding is Duplication of Methods?

Answers were Sorted based on User's Feedback



IS method overriding is Duplication of Methods?..

Answer / amol

No. In method overriding the behaviour of overrided method
is different. The subclass override only those methods,
which has different behaviour than superclass else alawys
use all the methods of superclass, which is better than
making a lot duplication by defining another class for same
methods of superclass.

Is This Answer Correct ?    29 Yes 1 No

IS method overriding is Duplication of Methods?..

Answer / 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

IS method overriding is Duplication of Methods?..

Answer / naveen kumar raavi

No.In subclass we will extend the functionality of super
class method.

Is This Answer Correct ?    7 Yes 0 No

IS method overriding is Duplication of Methods?..

Answer / sampada

yes and no.yes overiding is duplication of signatue only
but not implentation is duplicated.subclass gives diff
implementation of it.

Is This Answer Correct ?    3 Yes 1 No

IS method overriding is Duplication of Methods?..

Answer / guest

yes

Is This Answer Correct ?    3 Yes 18 No

Post New Answer

More Core Java Interview Questions

How many return statement are allowed in a function?

0 Answers  


What is the synonym of string?

0 Answers  


How can we find size of the object ?

5 Answers   CTS, RazorSight,


What is a java developer salary?

0 Answers  


Why to use nested classes in java?

0 Answers  






Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?

0 Answers   Genpact,


What are the 8 data types in java?

0 Answers  


What does sprintf return?

0 Answers  


Explain Global variables in Packages?

4 Answers  


Why are strings immutable in Java?

1 Answers  


class A{ some variables; public void a()throws Excepion1,Exception2{....} } class B extends A{ variables... public void a()throws E2,E3{.....} } Qns: here override of methods occurs or not,ore else wil give any compilation error or run properly..plz tell me briefly whts happening with the above codes....

4 Answers   Quinnox,


adapter class ?

2 Answers  


Categories