Java OCA OCP Practice Question 1672

Question

Which method declarations are valid declarations?

Select the three correct answers.

  • (a) void m(int... is) { }
  • (b) void m(int is...) { }
  • (c) void m(int... is, int i, String... ss) { }
  • (d) void m(String... ds) { }
  • (e) void m(String... ss, int len) { }
  • (f) void m(char[] ca, int... is) { }


(a), (d), and (f)

Note

The ellipses (....) must be specified before the parameter name.

Only one varargs parameter is permitted, and it must be the last parameter in the formal parameter list.




PreviousNext

Related