java switch case
switch(x){
case(0): //if x == 0
//do some stuff
break;
//add more cases
default: //when x does not match any case
//do some stuff
break;
}
java switch case
switch(x){
case(0): //if x == 0
//do some stuff
break;
//add more cases
default: //when x does not match any case
//do some stuff
break;
}
Java switch case with string
// Java switch case with string
public class SwitchCaseWithString
{
public static void main(String[] args)
{
String str = "twelve";
switch(str)
{
case "ten":
System.out.println("ten");
break;
case "eleven":
System.out.println("eleven");
break;
case "twelve":
System.out.println("twelve");
break;
default:
System.out.println("doesn't match");
}
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us