初学java,写了个程序测试一下:import java.io.IOException;public class Test
{
public static void main(String []args)
{
System.out.println("A program:"); while(true)
{
System.out.println("press Enter to exit");
} try
{
System.in.read();
}
catch(IOException e)
{
return;
}
}
}
try{} catch{} 语句放在while()之前可以运行,去掉while()后也可以运行,但放在while()之后就不行,它跟while()有什么冲突吗?
请高手们教教我,谢谢了!!