The second method is the only one that can match. You have only 1 argument. The first foo
has at least two required: an int
and a double
, so that can't match.
The second foo
matches because any number of numbers can match. Java will implicitly promote your int
1
to a double
so it can match, with method invocation conversion.