我的代碼如下所示:進行切換的情況下執行以往的案例
switch(read.nextInt()){
case 1:
//do "a" and print the result
break;
case 2:
//do "b" and print the result
break;
case 3:
//do "a" and print the result
//do "b" and print the result
}
是否有另一種方式做到這一點並不簡單地複製裏面有什麼情況下1和2? 我剛開始我的畢業,所以我只能用字符串併爲此掃描儀,謝謝:)
也許我不允許創建方法,而且這個答案非常合適,謝謝 – 2015-04-02 21:53:12