SwingWorker<void,void>?
I have the following class declaration:
publicclass blahextends SwingWorker<void,void>
and I get the following error:
Syntax error on token "void", Dimensions expected after this token.
What is the problem?
I have the following class declaration:
publicclass blahextends SwingWorker<void,void>
and I get the following error:
Syntax error on token "void", Dimensions expected after this token.
What is the problem?
> can't use int either? why can't it be a
> primative type?
Generics does not work on the primitive type level, so it must be something that derives from Object. You can use Integer instead, and if you want you can take advantage of autoboxing so that your code deals only with ints and not with Integer:
// Silly example to give you an idea of what I mean
class MySwingWorker extends SwingWorker<Integer, Object> {
@Override
public Integer doInBackground() {
return 1 + 2 + 3 + 4;
}
@Override
protected void done() {
int value = get();
...
}
}