jQuery in Action, 3rd edition
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

Function Overloading..?

Denis Dsouza

Joined: Apr 01, 2009
Posts: 2

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

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

Joined: Mar 24, 2008
Posts: 3899

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

Integer: 1
Double: 2.0

[How to ask questions] [Twitter]
Ankit Garg

Joined: Aug 03, 2008
Posts: 9435

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..?
It's not a secret anymore!