posted 15 years ago
Hi Sabber,
System.out has a println() method, but no pritln() method, so this was just a typo.
Regarding the while-loop, while(false) will _not_ cause a compiler error, even though the code inside the while-loop is de facto unreachable. Another example:
causes a compiler error, for the System.out.println() statement is unreachable.
also causes a compiler error, but a different one: myMethod() mut return a value of type int.
compiles just fine. This makes sense, eg for DEBUG boolean constants:
needs to compile, since otherwise setting a constant like DEBUG from true to false will cause compile errors, and probably a lot of them.
Another part is that an optimizer might throw de facto unreachable code out of the AST, so it does not exist in the final byte code, but it's not an error to have such statements.