How to use switch case in java?
int amount = 9;
switch(amount) {
case 0 : System.out.println(""amount is 0""); break;
case 5 : System.out.println(""amount is 5""); break;
case 10 : System.out.println(""amount is 10""); break;
default : System.out.println(""amount is something else"");
}
🔗Reference: stackoverflow.com
🔗Source: Java Interview Questions and Answers