Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the "..." mean in a parameter list? doInBackground(String... params)

Tags:

I don't understand that syntax. Trying to google various words plus "..." is useless.

like image 674
Jim Avatar asked Oct 18 '10 14:10

Jim


People also ask

What does string parameter mean?

It means you can pass an arbitrary number of arguments to the method (even zero). In the method, the arguments will automatically be put in an array of the specified type, that you use to access the individual arguments. Follow this answer to receive notifications.

What does params mean in Java?

Parameters. A parameter is a variable used to define a particular value during a function definition. Whenever we define a function we introduce our compiler with some variables that are being used in the running of that function.

What is in a parameter list?

The parameter list of a function describes the number and types of the arguments that the function accepts, and the number and types of the values it returns. The parameter list of a generic function is used to define the overall protocol of the generic function.

What is a params code?

params is a special keyword that allows passing a variable number of parameters into a method. It allows a nice, flexible syntax that helps us specify: One or multiple parameters separated by commas (that's the 'killer feature') No parameters at all. A single parameter of a single-dimensional array type.


Video Answer


1 Answers

It's called varargs. This fact should yield better Google results.

like image 110
BalusC Avatar answered Oct 20 '22 12:10

BalusC