| Author |
overloaded-overriden
|
Vishnu Prakash
Ranch Hand
Joined: Nov 15, 2004
Posts: 1026
|
|
O/P : ABC Class B extends class A and Class C extends class B, therefore method m1() is overdidden right?. But according to the output, method m1() is overloaded. Some one please explain how method m1() is overloaded and not overridden.
|
Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
|
 |
Rajasekar Elango
Ranch Hand
Joined: Sep 13, 2004
Posts: 105
|
|
Hi, Here the method m1() in subclasses B and C overloads the method m1() inherited from its parent class A. Overridding methods should have same method signature, both method parameters and return type should be same. Thanks, Raja
|
SCJP 1.4
|
 |
Krishna Srinivasan
Ranch Hand
Joined: Jul 28, 2003
Posts: 1803
|
|
method parameters are different.so it is method overloading.Overridden method signature must be same. Note: In Java 1.5 the return type of the overriding method can be different. When you override a method, the declared return type can be any subclass of the the class returned by the original method. Currently, the method signature of an overriding method has to match exactly that of the method that it is overriding, including the return type. http://forum.java.sun.com/thread.jspa?threadID=477074&messageID=2215964
|
Krishna Srinivasan
OCAJP Mock Questions
|
 |
 |
|
|
subject: overloaded-overriden
|
|
|