flush()是哪个类里的?
System.in.reset();好象不起作用。String s;
DataInputStream in =
new DataInputStream(
new BufferedInputStream(System.in));
try {
System.in.reset();//或用in.reset();都不行
s = in.readLine();
System.out.println(s);
} catch(IOException e) {}他还是不等我输入,就结束了,println打印的是一个空行,怎么回事?
System.in.reset();好象不起作用。String s;
DataInputStream in =
new DataInputStream(
new BufferedInputStream(System.in));
try {
System.in.reset();//或用in.reset();都不行
s = in.readLine();
System.out.println(s);
} catch(IOException e) {}他还是不等我输入,就结束了,println打印的是一个空行,怎么回事?
public static void main(String[] args) {
try {
// 1. Buffered input file
DataInputStream in =
new DataInputStream(
new BufferedInputStream(System.in));
String s, s2 = new String();
while((s = in.readLine())!= null)
s2 += s + "\n";
System.out.println("haha:"+s2);
in.close();
}catch(Exception e){}
}
}
你这个程序怎么跳出while循环啊?我试了一下,不能结束哎