这涉及Java版本7及更早版本。
引用同一问题的好答案:
如果以后希望将其作为字符串返回,则可以调用getPath()。确实,如果您真的想模仿Path.Combine,则可以编写如下内容:
public static String combine (String path1, String path2) { File file1 = new File(path1); File file2 = new File(file1, path2); return file2.getPath();}


