import java.io.*; class MyFileIo{ public static void main(String args[]){ FileInputStream fin; FileOutputStream fout; char ch; int data; try{ fin=new FileInputStream(FileDescriptor.in); fout=new FileOutStream("myfile1"); System.out.println("请输入一串字符以#结束:"); while((ch=(char)fin.read())!='#') fout.write(ch); fin.close(); fout.close(); System.out.println(""); fin=new FileOutputStream("myfile1"); fout=new FileOutputStream(FileDescriptor.out); while(fin.available()>0){ data=fin.read(); fout.write(data); } fin.close(); fout.close(); }catch(FileNotFoundException e){ System.out.println("File not found"); }catch(IOException e){} }
} 这个程序有2个问题,我截了图。。请看看。。Thank u!