File(File parent, String child) 
          根据 parent 抽象路径名和 child 路径名字符串创建一个新 File 实例。 
File(String parent, String child) 
          根据 parent 路径名字符串和 child 路径名字符串创建一个新 File 实例。 这是file类的两个构造方法参数?我不太理解 请高手解释下. 
最好举个例子 写出来看看!
还有个我看了个例子是File f = new File("D:\\a"); 这个a是存在的,有些例子是a是不存在的,搞不懂

解决方案 »

  1.   

    File(File parent, String child) 
              根据 parent 抽象路径名和 child 路径名字符串创建一个新 File 实例。 
    File(String pathname) 
              通过将给定路径名字符串转换成抽象路径名来创建一个新 File 实例。 
    File(String parent, String child) 
              根据 parent 路径名字符串和 child 路径名字符串创建一个新 File 实例。 
    public File(File file, String s)
        {
            if(s == null)
                throw new NullPointerException();
            if(file != null)
            {
                if(file.path.equals(""))
                    path = fs.resolve(fs.getDefaultParent(), fs.normalize(s));
                else
                    path = fs.resolve(file.path, fs.normalize(s));
            } else
            {
                path = fs.normalize(s);
            }
            prefixLength = fs.prefixLength(path);
        }    public File(String s, String s1)
        {
            if(s1 == null)
                throw new NullPointerException();
            if(s != null)
            {
                if(s.equals(""))
                    path = fs.resolve(fs.getDefaultParent(), fs.normalize(s1));
                else
                    path = fs.resolve(fs.normalize(s), fs.normalize(s1));
            } else
            {
                path = fs.normalize(s1);
            }
            prefixLength = fs.prefixLength(path);
        }