1. 程式人生 > >檔案操作路徑區別

檔案操作路徑區別

import   java.io.*;  
   
   
  public   class   SL275  
  {  
      public   static   void   main(String[]   args)  
      {  
          try  
          {  
              File   f=new   File("C:\\Winnt\\test.txt");  
              System.out.println(f.getCanonicalPath());  
              System.out.println(f.getAbsolutePath());  
              System.out.println(f.getPath());  
          }  
          catch(IOException   ioe)  
          {  
          }  
      }  
  }  
  輸出結果是:  
  C:\WINNT\test.txt  
  C:\Winnt\test.txt  
  C:\Winnt\test.txt