(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;



Reach Us

SERVICES

  • ACADEMIC
  • ON-LINE PREPARATION
  • FOUNDATION & CRASH COURSES

CONTACT

B-54, Krishna Bhawan, Parag Narain Road, Near Butler Palace Colony Lucknow
Contact:+ 91790552 9739