Can any one tell me return type included in method signature or not. if yes then Suppose a case when Two Classes are there A & B. B extends A. Now
class classBase{ public A method (){ ......... ........... return new A(); } } class classChild extends classBase{ public B method(){ ......... ........... return new B();
} } The Question is In this case Overriding is happening or not. [ June 30, 2006: Message edited by: vijay saraf ]
it means return type should exactly be the same as in base class's method. but i have read somewhere that signature means method name and parameter list.....excluding return type.is it ok??
wise owen
Ranch Hand
Joined: Feb 02, 2006
Posts: 2023
posted
0
A method's signature is its name and the number and the type of its arguments. The method return type, method modifiers, and declared thrown exceptions have no effect on the method signature.
S Thiyanesh
Ranch Hand
Joined: Mar 19, 2006
Posts: 142
posted
0
but i have read somewhere that signature means method name and parameter list.....excluding return type.is it ok??
This is called as Covariant return types included from Java 5.
This is a perfect override for SCJP 1.5 but a compiler error for SCJP 1.4.
vijay saraf
Ranch Hand
Joined: Jan 08, 2005
Posts: 141
posted
0
thanks all of you.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Is Return Type Included in Method Signature ?