变了一程序,对结果不解 (初学) 望赐教
Xmas 2002-03-17 11:03:41
import java.io.*;
public class t311
{
public static void main(String args[])
{
int iOut = 0;
char cTemp = ' ';
try
{
System.out.println("Please input chars (end with '#'):");
cTemp = (char)System.in.read();
if(cTemp == '#')
{
System.out.println("No effective data input . End");
System.exit(1);
}
else
{
iOut = (int)cTemp;
System.out.println(iOut);
}
System.out.println((int)cTemp);
cTemp = (char)System.in.read();
System.out.println((int)cTemp);
while(cTemp != '#')
{
iOut = Math.min(iOut, (int)cTemp);
cTemp = (char)System.in.read();
}
}catch(IOException e) {}
System.out.println("The min input character in ASCII is " + (char)iOut);
}
}
Starting application D:\JavaPro\t311.class
Command line: "D:\j2sdk1.4.0\bin\java.exe" -classpath D:\JavaPro t311
The current directory is: D:\JavaPro
Please input chars (end with '#'):
e
101
101
10
d
#
The min input character in ASCII is
Interactive Session Ended
为什么我再用cTemp = (char)System.in.read();的时候没有阻塞程序,并且下面输出的是10?