Multiple choice technology programming languages

Which of these statements are true?

  1. There can be any number of var-arg parameters in a method

  2. Only one var-arg parameter is allowed and it must be declared as last parameter in method definition.

  3. Only one var-arg parameter is allowed and it must be declared as first parameter in method definition.

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Java allows only one var-arg (variable arity) parameter per method, and it must be the last parameter declared. This enables calls with 0 to N arguments for that parameter. Multiple var-args or placing var-args first would create ambiguity in method invocation.