集册 Java实例教程 获取文件的绝对路径

获取文件的绝对路径

欢马劈雪     最近更新时间:2020-01-02 10:19:05

423
获取文件的绝对路径

import java.io.*;

 

public class Main {//来自 时代Java

 

  public static void main(String[] args) {

   

    String filePath = File.separator + "JavaExamples" + File.separator + "IO";

               

    File file = new File(filePath);

   

     System.out.println("Abstract file path is :" + file.getPath());

     System.out.println("Absolute file path is : " + file.getAbsolutePath());

 
 /* 
 *来 自
  n o w j a v a . c o m - 时代Java
 */

  }

}