package io1;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
public class Demo3 {
public static void main(String[] args) throws IOException {
File file = new File("src");
File file1 = new File("text1.txt");
if(!file1.exists()){
file1.createNewFile();
}
RandomAccessFile raf =
new RandomAccessFile(file1, "rw");
raf.writeInt(-9);
raf.writeDouble(11.2);
raf.writeChar('中');
raf.seek(0);
int a = raf.readInt();
double b = raf.readDouble();
char c = raf.readChar();
System.out.println(a+" ,"+ b+","+c);
raf.close();
}
}
阅读(1159) | 评论(0) | 转发(0) |