In the section about Using Assertions Appropriately, it states the 'assert false'-statement can be used if a section of code never should be reached. It is shown with an example of a switch-case-statement:
switch (x) { case 2: y=3; case 3: y=17; case 4: y=27; default: assert false; // We're never supposed to get here. }
The example isn't very good IMHO, because this example would qualify to be an exam question, because based upon the fall-through this would always throw an AssertionError, due to this missing break; statements.
The example isn't very good IMHO, because this example would qualify to be an exam question, because based upon the fall-through this would always throw an AssertionError, due to this missing break; statements.
No, this will throw AssertionError only if assertions are enabled.