2. Which of the following is not a valid comparison operator in Java?
3. What is the output of the following code snippet?
int x = 5;
if (x > 3) {
System.out.println("Hello");
}
int x = 5;
if (x > 3) {
System.out.println("Hello");
}
4. In Java, which statement is used to exit a loop prematurely?
5. What is the purpose of the "switch" statement in Java?
6. What is the default case in a "switch" statement used for?
7. In Java, which loop is suitable when you want to execute a block of code a specific number of times?
8. What is the result of the following code snippet?
int i = 1;
while (i <= 5) {
System.out.print(i + " ");
i++;
}
int i = 1;
while (i <= 5) {
System.out.print(i + " ");
i++;
}