What do the ... dots in the method parameters mean?

Submitted 3 years, 2 months ago
Ticket #337
Views 283
Language/Framework Java
Priority Medium
Status Closed

public void myMethod (String... strings)  {

// method body

}

What do the 3 dots in the above problem method mean?

Submitted on Feb 03, 21
add a comment

1 Answer

Verified

The three dots (...) are used in a function’s declaration as a parameter. These dots allow zero to multiple arguments to be passed when the function is called. The three dots are also known as var args(variable arguments).Varargs are very helpful if you don't know how many arguments you will have to pass in the method.

Submitted 3 years, 2 months ago


Latest Blogs