Java Language Varargs (Variable Argument) Specifying a varargs parameter

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

void doSomething(String... strings) {
    for (String s : strings) {
        System.out.println(s);
    }
}

The three periods after the final parameter's type indicate that the final argument may be passed as an array or as a sequence of arguments. Varargs can be used only in the final argument position.



Got any Java Language Question?