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
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
