I’m unfamiliar with the parameter syntax in doInBackground(Params... params)
What is this type of thing called, and how do I utilize it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As devA and VVV have said, that is called “varargs”. Effectively, the following two lines of code are equivalent:
and
the code inside the method would be the same, but when it was called, they would be called differently. The first would need to be called like this:
while the second one’s method signature could have 0 to (an assumed)infinite number of arguments, but they would all need to be String arguments. All of the following calls would work:
A subtle difference between the two is that you can call makeLemonade() legally here if you’re using varargs.