~/ learn/ java-from-zero/ cards/ Varargs
1 of 4

Type a varargs method signature

Type a varargs method signature

Answer

public static int sum(int... nums) {

Inside the method, nums is an int[]. The ... must be on the last parameter; only one varargs parameter is allowed per method.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/8fa37489-d406-4464-b339-c068afe9014a/flashcard utf-8 LF