0 votes
in JAVA by
How to use switch case in java?

1 Answer

0 votes
by

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

Related questions

0 votes
asked Jan 10, 2020 in JAVA by DavidAnderson
+3 votes
asked May 31, 2020 in JAVA by SakshiSharma
...