File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Function Overloading..? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Function Overloading..?" Watch "Function Overloading..?" New topic
Author

Function Overloading..?

Denis Dsouza
Greenhorn

Joined: Apr 01, 2009
Posts: 2
Hello,

Can any one help me understand why the output of the below always displays as

Double 1.0
Double 2.0




I tried to reorder the doSome functions, but always only the one with 'Double' parameter seems to execute.

Can anyone please let me know the logic behind this? Its driving me crazy..!
Denis Dsouza
Greenhorn

Joined: Apr 01, 2009
Posts: 2
Note: Assume the syntax & keywords are correct.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3860

Can you show us the output as it appears? This outputs

Integer: 1
Double: 2.0


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9321
    
  17

Vijitha is right. There is no way that the code can output Double both the times. Even if you try, you'll get a compilation error



SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Function Overloading..?