That isn't a variable. It's a generic argument of the Void class.
Edit- As for the varargs, they're unused, so it doesn't really matter that you can't instantiate a Void.
Question
While reading Google's tutorial on Cloud Endpoints for Android, I came across this code where they have passed a variable of type Void to a function. Is this correct? If yes, how does that work? Also, what is the point of passing variables named "unused" to functions if they are not going to be used by those functions?
public void onClickListGreetings(View unused) {
AsyncTask<Void, Void, HelloGreetingCollection> getAndDisplayGreeting =
new AsyncTask<Void, Void, HelloGreetingCollection> () {
@Override
protected HelloGreetingCollection doInBackground(Void... unused) {
// more code
As always, thanks so much for helping out!! :)
Solution
That isn't a variable. It's a generic argument of the Void class.
Edit- As for the varargs, they're unused, so it doesn't really matter that you can't instantiate a Void.