Why return type is not a part of method signature?

Showing Answers 1 - 21 of 21 Answers

sateesh

  • Nov 16th, 2006
 

Method signature contains

the type of the parameters

the no.of paramaters and

the order of paramaters

Method signatune is mainly used in methd overriding

  Was this answer useful?  Yes

chinnu

  • Nov 25th, 2006
 

writing two r more methods with same name ,same signature is called method overiding. return is also part of the method signature.

  Was this answer useful?  Yes

manu

  • Nov 27th, 2006
 

No. Return Type is not part of a method signature....signature consists of argument data type, no of arguments and order of arguments...if u try to write two functions having the same signature ie. as said by me in the previous line and then you try to write different return types for the two functions it will show "Function already exists" or "Duplicate function Not allowed" according to ur IDE. i.e the compiler is treating these two as the same method and not over rided or over loaded methods.

  Was this answer useful?  Yes

hi_goura

  • Dec 5th, 2006
 

return-type is not a part of method signature. Because return comes after you call the method.While calling the method you need only method name and arguments (of course number, type and order) and you dont need to know what is the return-type. After execution of the method is finished you bother about the value return by the method. If two methods are exactly same in name and arguments and different in return type only how will JVM know which method to call??? Not possible... right??? So there should be something different in method signature to differentiate the two methods.

  Was this answer useful?  Yes

rajnish

  • Dec 15th, 2006
 

because return type does not affedt the overriding or overloading

  Was this answer useful?  Yes

santh kumar

  • Dec 19th, 2006
 

It's java's Specification that describes like that the return type is not a part of method signature, whether it is method overloading or overriding. U clearly know that the type of parameters can be un-simillar in overloading and but should be similar in overriding.U know one thing , i specifically tested on the system.what will happend if i used different type of parameters even in Overriding? can u guess? Yes! it's true. it(compiler) doesnt show any errors.it just treat that method as regular method.

  Was this answer useful?  Yes

Ashok

  • Aug 3rd, 2017
 

Return Type is not part of a method signature..Kindly check again and dont put wrong answer on portal because it will confuse to other.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions