JAVA小练习134——File的练习

import java.io.*;

public class Demo134 {
	
	public static void main(String[] args)throws IOException {
		/*
		File file = new File("F:"+File.separator+"a.txt");
		System.out.println("存在吗:"+ file.exists());
		System.out.println("目录分隔符:"+ File.separator);
		*/
		
		File file2 = new File("."); 
		
		System.out.println("当前路径:"+file2.getAbsolutePath());
		
		
		File file = new File("..\\..\\a.txt");
		file.createNewFile();
		System.out.println("存在吗:"+ file.exists());
		
		
		
	}

}

猜你喜欢

转载自blog.csdn.net/Eric_The_Red/article/details/91972177