集册 Java实例教程 创建绝对路径

创建绝对路径

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

440
创建一个绝对路径

import java.net.URI;

import java.nio.file.FileSystems;
/*
N o w J a v a . c o m 提 供
*/

import java.nio.file.Path;

import java.nio.file.Paths;


public class Main {


    public static void main(String[] args) {

        Path path10 = Paths.get("C:/folder1/folder2/folder4", "test.txt");

        Path path11 = Paths.get("C:", "folder1/folder2/folder4", "test.txt");

        Path path12 = Paths.get("C:", "folder1", "folder2", "2009", "test.txt");

        Path path13 = Paths.get("C:/folder1/folder2/folder3/test.txt");

        Path path14 = Paths.get(System.getProperty("user.home"), 
展开阅读全文