按照字节的方式读写
public aa;
import java.io.*;
public class T{
publc static void main(String []arg)throw IOException{
FileOutputStream out = new FileOutputStream("d:\\Test.txt");
for (int i=20;i<=30;i++)
out.write(i);
out.close();//文件操作完毕记得关闭
FileInputStream in = new FileInputStream("d:\\Test.txt");
for(int i = 0;i<=10;i++)//当知道字符个数时可用for循环,否则使用while循环
System.out.println("in.read()+" ");
in.close();
/*
FileInputStream in = new FileInputStream("d:\\Test.txt");
int a;
while((a = in.read())!=-1)
System.out.println(a+" ");//java 文件中有个约定,结尾符号是-1
in.close();
*/}
}