import java.io.File;
import java.io.IOException;public class Creat {
public static void main(String[] args) throws IOException {
// File file= File.createTempFile("G:\\","1.txt");
String tempFilePath= "G:\\";
File tempDir = new File( tempFilePath );
File temp=File.createTempFile("wwe", ".txt ", tempDir);
System.out.print(temp.getAbsolutePath());
}}运行结果是在G盘下面生成一个wwe@@#@!#!@#.txt文件
为什么会有@@#@!#!@#这些啊
e@@#@!#!@#貌似是一串随机数
import java.io.IOException;public class Creat {
public static void main(String[] args) throws IOException {
// File file= File.createTempFile("G:\\","1.txt");
String tempFilePath= "G:\\";
File tempDir = new File( tempFilePath );
File temp=File.createTempFile("wwe", ".txt ", tempDir);
System.out.print(temp.getAbsolutePath());
}}运行结果是在G盘下面生成一个wwe@@#@!#!@#.txt文件
为什么会有@@#@!#!@#这些啊
e@@#@!#!@#貌似是一串随机数
在前缀之后,会跟一按照临时文件生成规则随机生成的字符串。createTempFile两个参数的方法,文件生成在临时文件夹下。
class Child
{
int no;
Child nextChild=null;
public Child(int no)
{
//给一个编号
this.no=no;
}
}
a.Child //Child类型
慢慢理解把