📄 fileinfo.java
字号:
package sample;
import java.io.*;
public class FileInfo{
public void info(File f) throws IOException{
System.out.println("Name: " + f.getName());
System.out.println("Path: " + f.getAbsolutePath());
if(f.exists()){
System.out.println("File is there");
System.out.println("File can read? " + f.canRead());
System.out.println("File can write? " + f.canWrite());
System.out.println("File length is: " + f.length());
}
else
System.out.println("File doesn't exist");
}
public static void main(String[] args) throws IOException {
if(args.length > 0){
for(int i = 0; i<args.length; i++){
File file = new File(args[i]);
new FileInfo().info(file);
}
} else
System.out.println("No file to check!");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -