假设文本文件“test.txt”存在,那么下面的程序可以正常运行,并且运行的结果是将文件“test.txt”的内容显示在控制台窗口中
import java.io.*;
public class J_Test{
public static void main(String args[]) throws IOException{
int b;
FileInputStream f=new FileInputStream("test.txt");
for(;(b=f.read())!=-1;)
System.out.print((char)b);
System.out.println(); f.close();
}
}
正确错误
import java.io.*;
public class J_Test{
public static void main(String args[]) throws IOException{
int b;
FileInputStream f=new FileInputStream("test.txt");
for(;(b=f.read())!=-1;)
System.out.print((char)b);
System.out.println(); f.close();
}
}
正确错误