0

I am following a book and got the below code:

    private class DownloadTask extends AsyncTask<String, Void, Bitmap> 
    {    
         @Override         
         protected Bitmap doInBackground(String... params) 
         {             
             String url = params[0]; 
             // ...
         }
    }

What does String... params (parameter of doInBackground() method) do?

harpun
  • 4,022
  • 1
  • 36
  • 40
shaon007
  • 163
  • 3
  • 16

1 Answers1

0

This is known as Varargs and you can read more in the docs here: http://docs.oracle.com/javase/1.5.0/docs/guide/language/varargs.html

In short it means you can pass the final argument as a sequence of individual arguments or an array.

Scott Helme
  • 4,786
  • 2
  • 23
  • 35