• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Can we have two methods with same name but different return types in a class ?
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 .

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic