File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes method overloding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "method overloding" Watch "method overloding" New topic

method overloding

manohar reddy

Joined: Oct 13, 2007
Posts: 12
If we have two methods with the same name and same number and type of parameters with different return types. Which of the methods takes the precedence?
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

A method can't have the same method name, but different return type.

SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Olivier Legat
Ranch Hand

Joined: Nov 17, 2007
Posts: 176

You would simply get an error

I agree. Here's the link:
subject: method overloding
It's not a secret anymore!