Q. What is the output of the below Java program with SWITCH and Strings?

Code:
String phone = "APPLE";
switch(phone)
{
case "Apple": System.out.println("Apple");break;
case "APPLE": System.out.println("APPLE");break;
case "SAMSUNG": System.out.println("SAMSUNG");
}
  • (A) Apple
  • (B) APPLE
  • (C) SAMSUNG
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (B) APPLE

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
260
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
87%
Success Rate