package javaapplication1;
public class JavaApplication1 {
public static void main(String[] args) {
try {
String value = "jx";
switch (value.charAt(0)) {
case 'j':
switch (value.charAt(1)) {
case 'x':
System.out.println("second letter is 'x'");
break;
default: {
System.out.println("second letter is not 'x'");
}
}
break;
case 'a':
System.out.println("x");
break;
case 'b':
System.out.println("y");
break;
default: {
System.out.println("first letter is not 'j', 'a' or 'b'");
}
}
} catch (Exception e) {
System.out.print(e.toString());
}
}
}
/*
run:
second letter is 'x'
*/