- 8
- 0
- 约2.76万字
- 约 94页
- 2017-06-13 发布于湖北
- 举报
File handling File类 RandomAccessFile类 Example—separator(分隔符) //显示分隔符 import java.io.*; public class Prova { public static void main(String[] arg) { System.out.println(File.separator+ - + File.separatorChar+ - + File.pathSeparator+ - + File.pathSeparatorChar); } } Output (in Windows) \ - \ - ; - ; Output (in Unix): / - / - : - : Example: 创建文件和文件夹 Example: 文件的随机访问类(RandomAccessFile) 定义了对各种数据类型进行读写的方法,如:byte, char, double, float, int, short, long等。 可以用getFilePointer()方法获得当前的文件读取指针,可以用seek(long?pos)方法访问记录,并进行读写。 getFilePointer():返回文件指针在文件中的当前偏移量。
原创力文档

文档评论(0)