Java Java File.toPath()
方法具有以下語法。
public Path toPath()
在下面的程式碼顯示如何使用File.toPath()
方法。
import java.io.File;
public class Main {
public static void main(String[] args) {
File file = new File("c:/a.html");
System.out.println(file.toPath());
}
}
上面的程式碼生成以下結果。
c:/a.html