本帖最后由 李娟 于 2011-12-23 23:07 编辑
public static void readFile()throws IOException
{
RandomAccessFile raf = new RandomAccessFile("ran.txt","r");
byte[] buf = new byte[4];
raf.read(buf);
String name = raf.readInt(); //运行报错,类型不匹配
int age = raf.readInt();
System.out.println("name="+name);
System.out.println("age="+age);
raf.close();
}
|