Skip to content
CodeKruPro

Varargs parameters

QuizEasy-MediumJava only

Given static int sum(int... nums) that adds its arguments, which statements are true? Pick all that apply.

  • sum() compiles and returns 0
  • sum(new int[]{4, 5}) compiles and returns 9
  • static int sum(int... nums, String label) compiles
  • Inside the method, nums is an int[]

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in