KnowledgeBoat Logo

Computer Applications

What will be the output of the following code?


int fruit = 3;
switch (fruit + 1)
{
case 1:
System.out.println("Banana");
break ;
case 2:
System.out.println("Apple");
break ;
case 3:
System.out.println("Orange");
break ;
default :
System.out.println("Fruitless");
}
  1. Orange
  2. Banana
  3. Apple
  4. Fruitless

Java Conditional Stmts

3 Likes

Answer

Fruitless

Answered By

1 Like


Related Questions