Consider a method defined with the header:

public static void doStuff(int x)
Which of the following method calls is legal?

1. doStuff(0.1 + 0.2);
2. doStuff(9);
3. all of the options are legal except for one
4. doStuff(0.555);
5. doStuff(0.1, 0.2);

Respuesta :

tonb
The floating point number will be demoted to an int, so 1 and 4 are fine. 2 is fine naturally, but 5 is invalid (2 params passed where 1 is expected).
Therefore option 3 is correct: all of the options are legal except for 5