今天做的一个先将字符串保存到本地文件的功能,但是不知道怎么获取本地文件的临时路径了。
废话不多说,直接上代码:
public class MyTest {
public static void main(String[] args) {
String tempPath =System.getProperty("java.io.tmpdir")+File.separator;
System.out.println(tempPath);
}
}
结果:
今天做的一个先将字符串保存到本地文件的功能,但是不知道怎么获取本地文件的临时路径了。
废话不多说,直接上代码:
public class MyTest {
public static void main(String[] args) {
String tempPath =System.getProperty("java.io.tmpdir")+File.separator;
System.out.println(tempPath);
}
}
结果: