我是一个自学者,身边没有一个老师,也没有一个同学,有不会只好上网请教。在JAVA程序经常遇到IOException编译通不过。如下面这个程序:
import java.io.InputStream;
import java.io.IOExcepton;
public class J_Echo { /**
* @param args the command line arguments
*/
public static void mb_echo(InputStream in) {
try
{
while(true)
{
int i=in.read();
if(i==-1)
break;
char c=(char) i;
System.out.print(c);
}
}
catch(IOException e)
{
System.err.println("发生异常:"+e);
e.printStackTrace();
}
System.out.println();
}
public static void main(String args[])
{
mb_echo(System.in);
}
}
编译时两出错误,皆因为IOException,我不知怎么回事,怎么修改?希望大家指点。
import java.io.InputStream;
import java.io.IOExcepton;
public class J_Echo { /**
* @param args the command line arguments
*/
public static void mb_echo(InputStream in) {
try
{
while(true)
{
int i=in.read();
if(i==-1)
break;
char c=(char) i;
System.out.print(c);
}
}
catch(IOException e)
{
System.err.println("发生异常:"+e);
e.printStackTrace();
}
System.out.println();
}
public static void main(String args[])
{
mb_echo(System.in);
}
}
编译时两出错误,皆因为IOException,我不知怎么回事,怎么修改?希望大家指点。
你怎么编译的啊