void run() {
...
if (done) return cancel();
...
}
where cancel() return void. This won\'t compile... and I ca
It's like writing:
void v = (void) 1;
return (v);
So, I think void is not a type in Java. In C++, return cancel(); is legal. As a C++ programmer who is familiar with Java the answer is: Many things are not supported in Java syntax. Maybe for simplicity or readibility.
Note: A void f() declaration is similar to a procedure f() declaration in pascal and a procedure could not return any value such as functions, so we must call them in a separated statement.