Last active
November 2, 2017 22:06
-
-
Save bdkosher/65307b28071fa8c7e467df687abd0a9d to your computer and use it in GitHub Desktop.
Groovy prints "Double baby", which differs from Java which will print out "Number baby"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void foo(double d) { | |
println 'Double baby' | |
} | |
void foo(Number n) { | |
println 'Number baby' | |
} | |
foo(Double.valueOf(10d)) | |
// Consider blog comparing method dispatch between Java and Groovy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment