您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Java 实例 - 在指定目录中创建文件

2025/8/11 4:42:32发布19次查看
以下实例演示了使用 file 类的 file.createtempfile() 方法在指定目录中创建文件:
/* author by w3cschool.cc main.java */import java.io.file;public class main { public static void main(string[] args) throws exception { file file = null; file dir = new file("c:/"); file = file.createtempfile ("javatemp", ".javatemp", dir); system.out.println(file.getpath()); }}
以上代码运行输出结果为:
c:\javatemp37056.javatemp
以上就是java 实例 - 在指定目录中创建文件的内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product