Java打开纯文本文件


Java打开纯文本文件

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();

      }

   }

}