Switch Statement

Learn Switch Statement in Java

public class Demo {
public static void main(String args[]) {

int age = 100;

switch (age) {
case 5:
System.out.println(“Your age is 5”);
break;

case 10:
System.out.println(“Your age is 10”);
break;

case 15:
System.out.println(“Your age is 15”);
break;

case 20:
System.out.println(“Your age is 20”);
break;

case 25:
System.out.println(“Your age is 25”);
break;

default:
System.out.println(“We dont know your age”);
break;

}

}

}

 

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.