Java 实例 - 获取文件的上级目录
Java 教程
· 2019-02-11 07:13:32
以下实例演示了使用 File 类的 file.getParent() 方法来获取文件的上级目录:
Main.java 文件
import java.io.File;
public class Main {
public static void main(String[] args) {
File file = new File("C:/File/demo.txt");
String strParentDirectory = file.getParent();
System.out.println("文件的上级目录为 : " + strParentDirectory);
}
}
以上代码运行输出结果为:
文件的上级目录为 : File
点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html
APIs
Daniel Jacobson、Greg Brail、Dan Woods / O'Reilly Media / 2011-12-24 / USD 24.99
Many of the highest traffic sites get more than half of their traffic not through the browser but through the APIs they have created. Salesforce.com (more than 50%) and Twitter (more than 75% fall int......一起来看看 《APIs》 这本书的介绍吧!