aspose file tools
The moose likes Java in General and the fly likes Can we have two methods in a class with sama name but different return type? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Can we have two methods in a class with sama name but different return type?" Watch "Can we have two methods in a class with sama name but different return type?" New topic
Author

Can we have two methods in a class with sama name but different return type?

Nagaraj Shivaklara
Ranch Hand

Joined: Dec 16, 2008
Posts: 72
Hi All,

Can we have two methods with same name but different return types in a class ?


Thanks n Regards,
Nagaraj S K
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

what is your opinion? you cant have two methods with same signature[name and parameter] in a class

just for an information : however,Nested class can have a method which is already defined in Outer class, but it is different
Nagaraj Shivaklara
Ranch Hand

Joined: Dec 16, 2008
Posts: 72
Thank you Seetharam.

Seetharaman Venkatasamy wrote:what is your opinion? you cant have two methods with same signature[name and parameter] in a class

just for an information : however,Nested class can have a method which is already defined in Outer class, but it is different
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Nagaraj Shivaklara wrote:Thank you Seetharam.

you are welcome

so, in your case you are concern with only method *name* insteadof signature, so overloading[reusing name] is possible .
Nagaraj Shivaklara
Ranch Hand

Joined: Dec 16, 2008
Posts: 72
Hi Seetharaman,

Thank you, also i posted one exception which i am getting while doing struts project(under Application Frameworks ยป Struts) ..

Can you please help me with that?

Seetharaman Venkatasamy wrote:
Nagaraj Shivaklara wrote:Thank you Seetharam.

you are welcome

so, in your case you are concern with only method *name* insteadof signature, so overloading[reusing name] is possible .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can we have two methods in a class with sama name but different return type?
 
Similar Threads
JavaCaps mock 1 Q:39
why does it throws compilation error in the subclass?
method overloding
Jval Test : Overriding & Overloading
Multiple interfaces