📄 file.java
字号:
import java.io.File;
class file
{
public static void main(String args[])
{
File file1 = new File("file.txt");
System.out.println("File: " + file1.getName() + (file1.isFile() ?
" is a file" : " is a named pipe"));
System.out.println("Size: " + file1.length());
System.out.println("Path: " + file1.getPath());
System.out.println("Absolute Path: " + file1.getAbsolutePath());
System.out.println("File was last modified: " + file1.lastModified());
System.out.println(file1.exists() ? "File exists" : "File does not exist");
System.out.println(file1.canRead() ? "File can be read from" :
"File cannot be read from");
System.out.println(file1.canWrite() ? "File can be written to" :
"File cannot be written to");
System.out.println(file1.isDirectory() ? "File is a directory" :
"File is not a directory");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -