πŸ“Š JAVA
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){}
πŸ’¬ Discuss
βœ… Correct Answer: (D) static void add(int...args){}

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

Explanation by: Bhagwan Das
var-args = variable number of arguments = 0 or many

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
207
Total Visits
πŸ“½οΈ
12 mo ago
Published
πŸŽ–οΈ
Bhagwan Das
Publisher
πŸ“ˆ
95%
Success Rate