In the code below, what happens when assertions are disabled?The answer given is that it prints ABCE.
My question is if it prints E then why doesn't it go through next iterations of the for loop and print more letters?please explain.
class C {
String m1(int i) {
switch (i) {
case 0: return "A";
case 1: return "B";
case 2: return "C";
default:
assert false;
}
return "E";
}
public static void main(String[] args) {
C c = new C();
for (int i = 0; i < 4; i++) {
System.out.print(c.m1(i));
}}}