🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Java Methods: all 10 questions

Quiz: Java Methods · Question 5 of 10

What does sum(int... nums) receive as nums when called as sum(1, 2, 3)?

What does sum(int... nums) receive as nums when called as sum(1, 2, 3)?

  1. A.three separate ints
  2. B.an int array {1, 2, 3}
  3. C.a List<Integer>
  4. D.the number 6
Answer & explanation

Correct answer: an int array {1, 2, 3}

Varargs parameters are arrays inside the method.

Can you get the rest right without peeking?

Take the timed Quiz: Java Methods quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →