Java OCA OCP Practice Question 1421

Question

Identify valid method declarations.

Select 1 option

  • A. public void m (int... i, String s);
  • B. public void m (int... i, String... s);
  • C. public void m (int i, int... j);
  • D. public int... m (int i);


Correct Option is  : C

Note

For Option A.

A var-args parameter must always be the last one.

For Option B.

A method can have only one var-args parameter.

For Option D.

The ... syntax is not applicable for return type.




PreviousNext

Related