我的代码如下所示:进行切换的情况下执行以往的案例
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