मराठी

Convert the following construct as directed: if-else-if construct into switch case: if (var == 1) System.out.println("Distinction"); else if (var == 2) - Computer Applications

Advertisements
Advertisements

प्रश्न

Convert the following construct as directed:

if-else-if construct into switch case:

if (var == 1) 
    System.out.println("Distinction"); 
else if (var == 2) 
    System.out.println("First Division"); 
else if (var == 3) 
    System.out.println("Second Division"); 
else 
    System.out.println("invalid");
थोडक्यात उत्तर

उत्तर

switch (var)
{case 1: System.out.println("Distinction"); break; 
case 2: System.out.println("First Division"); break
case 3: System.out.println("Second Division"); break;
default: System.out.println("invalid");
}
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 1.08: Conditional Statements in Java - EXERCISES [पृष्ठ ९९]

APPEARS IN

अविचल Computer Applications [English] Class 10 ICSE
पाठ 1.08 Conditional Statements in Java
EXERCISES | Q IV. 2. | पृष्ठ ९९
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×