As mentioned in this answer, there are rules followed when selecting which overloaded method to use.
To quote:
- Primitive widening uses the smallest method argument possible
- Wrapper type cannot be widened to another Wrapper type
- You can Box from int to Integer and widen to Object but no to Long
- Widening beats Boxing, Boxing beats Var-args.
- You can Box and then Widen (An int can become Object via Integer)
- You cannot Widen and then Box (An int cannot become Long)
- You cannot combine var-args, with both widening and boxing.
(Let's redefine rule 1 like so: "Primitive widening uses the most specific method argument as possible.")
So with these rules in mind we can get an idea of what's going on here:
According to rule number one, primitive widening uses the most specific method argument as possible. Since an int is representing by a non-decimal number (e.g. 1) and a double is represented by a decimal-number with precision 32 bytes more than that of a float (e.g. 1.0), we can say that ints are "less than" or "smaller than" doubles, and by that logic, ints can be "promoted" to doubles and doubles can be "demoted" to ints.
Put simply, a primitive that can be widened to another primitive (e.g. int -> float -> double) is more specific than another. For example, an int is more specific than a double because 1 can be promoted to 1.0.
When you passed in no arguments to these overloaded vararg methods of the same name, since the return is effectively the same (0 and 0.0 respectively), the compiler would choose to use the method that takes in a vararg of type int since it is more specific.
So, then, when you introduced these same methods that take in ints and booleans (types that cannot be widened to each other) respectively, the compiler now cannot choose a method to use since ints cannot be "promoted" or "demoted" like ints, floats and doubles. Therefore, it will throw a compile error.
I hope this helps you to understand what's happening.