public native long getFilePointer() throws IOException;//当前文件的指针位置是
import java.io.IOException; import java.io.RandomAccessFile; public class IntegerDemo { public static void main(String[] args) throws IOException { myWrite(); } private static void myWrite() throws IOException { // TODO Auto-generated method stub RandomAccessFile raf = new RandomAccessFile("E:\zikao\file\cs.txt", "rw"); raf.writeInt(100); raf.writeChar('a'); raf.writeUTF("中国"); System.out.println("当前文件的指针位置是:" + raf.getFilePointer()); raf.close(); } }