|
|
|
|
|
by Dewie
4797 days ago
|
|
I've on a few occasions had problems with semicolons in Java: accidently putting a semicolong like this: if (something()); {
somethingOther();
} The semicolon seemed to shortcut the whole if-block. I don't know why that thing is even allowed by the compiler. |
|
As for the second {}, its to allow you to create inner scopes where you can declare variables with a more restricted scope without needing to do something silly like "if(true)".
Empty block statements are OK sometimes with while and for loops when the real action that matters is in the condition:
And since these language