What will the following code print when run?
public class TestClass {
public static void main(String[] args) throws Exception { //1
var flag = true; //2
switch (flag){ //3
case true -> System.out.println("true");
default -> System.out.println("false");
}
}
}
Compilation error at line marked //3.
A boolean cannot be used for a switch statement/expression. It needs an integral type (including wrappers), an enum, or a String. |
Using a continue in a while loop causes the loop to break the current iteration and start the next iteration of the loop
True