🎴 Flashcard Mode

Java (GATE)

Card1 / 13
Mastered0
Review0
QuestionClick to flip

What is the output of the given program?

public class HelloWorld {
 public static void main(String[] args) {
  String s1 = "Welcome to Aliensbrain";
  String s2 = "Welcome to Aliensbrain";
  switch (s1 == s2) {
   default: System.out.println("Bye");
   case 1:
     System.out.println("Hello Italy");
   case 0:
     System.out.println("Hello Paris");
  }
 }
}
AnswerClick to flip back
A
Compiler Error
💡 Explanation:

This is the correct answer.

Change Mode