1

I am currently studying AsyncTask.

I noticed that there is an ellipsis after the data type of the first parameter.

class MyClass extends AsyncTask<Integer, Integer, Bitmap>
{
   @Override
   protected Bitmap doInBackground(Integer... id)
   {
      Bitmap btmp = //insert some code here
      return btmp;
   }
}

What is that ellipsis does?

Shizuka Masuda
  • 89
  • 3
  • 13

1 Answers1

3

The ellipsis is the three dot (...) notation is actually borrowed from mathematics, and it means "...and so on".

As for its use in Java, it stands for varargs, meaning that any number of arguments can be added to the method call. The only limitations are that the varargs must be at the end of the method signature and there can only be one per method.