⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileinfo.java

📁 《Java核心技术应用开发》电子工业出版社书籍源代码
💻 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 + -