如何在Java中打开纯文本文件?
您可以使用File类访问纯文本。
示例
import java.io.File;
public class ReadFile {
public static void main(String[] args) {
File f = null;
String str = "data.txt";
try {
f = new File(str);
boolean bool = f.canExecute();
String a = f.getAbsolutePath();
System.out.print(a);
System.out.println(" is executable: "+ bool);
} catch (Exception e) {
e.printStackTrace();
}
}
}输出结果
C:\Users\data is executable: true
热门推荐
10 18岁的祝福语简短
11 孩子满月随礼简短祝福语
12 中班入学祝福语简短大全
13 祝朋友祝福语简短好看
14 女性生日祝福语简短优美
15 上司生日祝福语简短 女性
16 高考给舍友祝福语简短
17 朋友明天手术祝福语简短
18 宝宝100日简短祝福语