Multiple choice technology architecture

public class Va { public static void main(String[] args) { doCalc(1,2); doCalc(2); } //Point1. code to be inserted here } Which of the following inserted individually at Point1 will compile?

  1. Static void doCalc(int x, int… args) {}

  2. Static void doCalc(int… args, int x) {}

  3. Static void doCalc(int[] args)

  4. Static void doCalc(int args…)

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

Java varargs syntax requires the varargs parameter to be the LAST parameter. Option A follows this: int x, int... args (x is fixed, args is varargs at end). Option B is invalid: int... args, int x (varargs cannot be followed by other parameters). Option C is missing the varargs syntax (three dots). Option D has incorrect placement and syntax.