標題:
[模擬考]TQC+ 210
[打印本頁]
作者:
王彥甯
時間:
2017-6-10 12:22
標題:
[模擬考]TQC+ 210
完成TQC+ 210 題目
作者:
王彥甯
時間:
2017-6-10 12:23
import java.util.*;
class JPA02 {
static Scanner keyboard = new Scanner(System.in);
public static void main(String[] args) {
test();
test();
test();
test();
test();
}
public static void test() {
System.out.println("Input a character:");
String a = keyboard.nextLine();
switch(a)
{
case"a":
System.out.println("You entered a or b");
break;
case"b":
System.out.println("You entered a or b");
break;
case"x":
System.out.println("You entered x");
break;
case"y":
System.out.println("You entered y");
break;
default:
System.out.println("You entered something else");
break;
}
}
}
複製代碼
作者:
張健勳
時間:
2017-6-10 12:24
import java.util.*;
public class JPA02{
static Scanner keyboard = new Scanner(System.in);
public static void main(String[] args) {
test();
test();
test();
test();
test();
}
public static void test() {
System.out.println("Input a character:");
String c = keyboard.nextLine();
switch(c.charAt(0)) {
case 'a':
case 'b':
System.out.println("You entered a or b");
break;
case 'x':
System.out.println("You entered x");
break;
case 'y':
System.out.println("You entered y");
break;
default:
System.out.println("You entered something else.");
break;
}
}
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2