2007-02-02 17:22:28 +00:00
|
|
|
public class Switch1 {
|
2007-03-12 02:08:45 +00:00
|
|
|
public static void main(String[] args) {
|
|
|
|
Switch1 s1= new Switch1();
|
|
|
|
s1.testOne(args);
|
|
|
|
s1.testTwo(args);
|
|
|
|
s1.testThree(args);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void testOne(String[] args) {
|
|
|
|
char ch;
|
|
|
|
switch(Integer.parseInt(args[0])) {
|
|
|
|
case 0: ch=Character.forDigit(Integer.parseInt(args[1]), 10); break;
|
|
|
|
case 1: ch=Character.forDigit(Integer.parseInt(args[2]), 10); break;
|
|
|
|
case 2: ch=Character.forDigit(Integer.parseInt(args[3]), 10); break;
|
|
|
|
case 3: ch=Character.forDigit(Integer.parseInt(args[4]), 10); break;
|
|
|
|
default: ch= '?'; break;
|
2007-02-02 17:22:28 +00:00
|
|
|
}
|
2007-03-12 02:08:45 +00:00
|
|
|
System.out.println(ch);
|
|
|
|
}
|
|
|
|
|
|
|
|
public char testTwo(String[] args) {
|
|
|
|
switch(Integer.parseInt(args[0])) {
|
|
|
|
case 0: return Character.forDigit(Integer.parseInt(args[1]), 10);
|
|
|
|
case 1: return Character.forDigit(Integer.parseInt(args[2]), 10);
|
|
|
|
case 2: return Character.forDigit(Integer.parseInt(args[3]), 10);
|
|
|
|
case 3: return Character.forDigit(Integer.parseInt(args[4]), 10);
|
|
|
|
default: return '?';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void testThree(String[] args) {
|
|
|
|
char ch = '?';
|
|
|
|
switch(Integer.parseInt(args[0])) {
|
|
|
|
case 0: ch=Character.forDigit(Integer.parseInt(args[1]), 10); break;
|
|
|
|
case 1: ch=Character.forDigit(Integer.parseInt(args[2]), 10); break;
|
|
|
|
case 2: ch=Character.forDigit(Integer.parseInt(args[3]), 10); break;
|
|
|
|
case 3: ch=Character.forDigit(Integer.parseInt(args[4]), 10); break;
|
|
|
|
}
|
|
|
|
System.out.println(ch);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|