import java.io.*;
public class FileDemo1 {
public static void main(String[] args)throws Exception {
int size;
InputStream f=new FileInputStream("FileDemo1.java");
System.out.println("Total Aviable Bytes:"+(size=f.available()));
int n=size/40;
System.out.println("First"+n+"bytes of file one read() at a time");
for(int i=0;i<n;i++){
System.out.println(f.read());
}
System.out.println("\nStill Avaible:"+f.available());
System.out.println("Reading the next"+n+"with one read()");
byte b[]=new byte[n];
if(f.read(b)!=n){
System.err.println("couldn't read"+n+"bytes");
}
System.out.println(new String(b,0,n));
System.out.println("nStill Avaible:"+(size=f.available()));
System.out.println("Skipping half of remaining bytes with skip()");
f.skip(size/2);
System.out.println("Still Avaible:"+f.available());
System.out.println("Reading"+n/2+"into the end of array");
if(f.read(b,0,n/2)!=n/2){
System.out.println("couldn't read"+n/2+"bytes");
}
System.out.println(new String(b,0,n/2));
System.out.println("\nStill Avaible:"+f.available());
f.close();
}
}
这个程序为什么运行时系统提示找不到指定文件啊?