Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Function Overloading..?

 
Denis Dsouza
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note: Assume the syntax & keywords are correct.
 
Vijitha Kumara
Bartender
Pie
Posts: 3918
10
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show us the output as it appears? This outputs

Integer: 1
Double: 2.0

 
Ankit Garg
Sheriff
Posts: 9529
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic