在java文件路径中的波浪号(〜)

时间:2018-05-12 08:14:21

标签: java file testing path

知道为什么即使在Windows环境下也能正常工作?    你能指点我的一些文件解释为什么这有效吗?    我试图寻找它没有结果。

 package com.my.example;

    import org.junit.Test;

    import java.io.File;
    public class TestPathCreation
    {
        @Test
        public void testPathCreation() throws Exception {
            final String path = "~/.my/dir";
            System.out.println(path);
            File f = new File(path);
            System.out.println(f.mkdirs()); // true
        }
    }

0 个答案:

没有答案