(iii) A student executes the following program segment and gets an error. Identify the statement which has an error, correct the same to get the output as WIN.
boolean x = true;
switch(x)
{
case 1: System.out.println("WIN");
break;
case 2: System.out.println("LOOSE");
}
Solution
Statement with error - boolean x=true ; To get the required output - int x = 1;