|
import java.io.*;
public class Echo {
private static int n1,Time1;
private static String name1;
public static void selectA(int select) throws IOException {
BufferedReader in = new BufferedReader(
new InputStreamReader(System.in));
BufferedInputStream din = new BufferedInputStream(System.in);
int s = select + 'a' - 1;
switch((char)s) {
case 'a': {
System.out.println("Input the number:");
n1=din.read();
for(int i=1;i<=n1;i++) {
System.out.print("The No."+i+" name:");
name1=in.readLine();
System.out.print(" and the time:");
Time1=din.read();
}
in.close();
din.close();
call();break;
}
}
}
public static void call() {
System.out.println(n1 + " " + name1 + " " +Time1);
}
public static void main(String[] args) throws IOException {
BufferedInputStream stdin = new BufferedInputStream(System.in);
int s;
System.out.print("input the number (1):");
s = stdin.read();
selectA(s); //为什么没有条用到这个函数?
System.out.print("continue to input:");
stdin.read(); //为什么我运行的时候就不能再继续在键盘输入呢?
stdin.close();
}
}
运行的输出是input the number(1):1
continue to input:
1是我输入的。。
还想问下重定向是什么意思。。
先谢谢楼下的朋友帮忙 |
|