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.
Advertisements
प्रश्न
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");
}एक पंक्ति में उत्तर
Advertisements
उत्तर
Statement with error - boolean x=true ; To get the required output - int x=1;
shaalaa.com
Introduction of Conditional Statements in Java
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
