我用System.out.write(97);
System.out.write(98);无法输出数据,请问为何?还有 int a=0;
while((a=System.in.read())!=-1)
{
System.out.write(a);
}
我输入a按回车,可一输出a,但把while换成if就没有用了
这是怎么回事啊?
System.out.write(98);无法输出数据,请问为何?还有 int a=0;
while((a=System.in.read())!=-1)
{
System.out.write(a);
}
我输入a按回车,可一输出a,但把while换成if就没有用了
这是怎么回事啊?
System.out.write(98);
System.out.flush();//刷新缓冲一下
多谢了.但是我还有个问题:
int a;
while((a=System.in.read())!=-1)
{
}
如果输入1,按回车,while不是应该循环6次吗.
read()每次读一个字节.整型四个字节,加上回车和换行,应该是六次才对.但结果好象不是的.
请问什么原因?