Skip to content

Instantly share code, notes, and snippets.

@Shavindra
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shavindra/47ebb670047054e04f65 to your computer and use it in GitHub Desktop.
Save Shavindra/47ebb670047054e04f65 to your computer and use it in GitHub Desktop.
public static void witchStatment(int num) {
System.out.println("\nEXAMPLE: Switch Statement");
switch(num){ //Check the value
case 0:
System.out.println("Case = " + num); // Execute this if 'case' matches the 'value'
break; // Stop the statement
case 1:
System.out.println("Case = " + num); // Execute this if 'case' matches the 'value'
break; // Stop the statement
case 2:
System.out.println("Case = " + num); // Execute this if 'case' matches the 'value'
break; // Stop the statement
case 3:
System.out.println("Case = " + num); // Execute this if 'case' matches the 'value'
break; // Stop the statement
case 4:
System.out.println("Case = " + num); // Execute this if 'case' matches the 'value'
break; // Stop the statement
default:
System.out.println("Default = " + num);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment