The following code gives me compile-time errors: missing return value and missing return statement, what value would I return for this Void Type?
final SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
// some code
if (something) {
return;
}
}
}
Voidis notvoid, change it to void type if you don’t want to return anything.Void is a class, void is type.
If you want
Void, then you need to addreturnstatement at end.Example: