A

Admin • 832.27K Points
Coach

Q. Choose all the lines which if inserted independently instead of "//insert code here" will allow the following code to compile:
public class Test{
public static void main(String args[]){
add();
add(1);
add(1, 2);
}

// insert code here
}

  • (A) void add(Integer... args){}
  • (B) static void add(int... args, int y){}
  • (C) static void add(int args...){}
  • (D) static void add(int...args){}
  • Correct Answer - Option(D)
  • Views: 38
  • Filed under category Java
  • Hashtags:

Explanation by: Admin

var-args = variable number of arguments = 0 or many

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.