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());
		
		
		
	}

}

你可能感兴趣的:(JAVA小练习134——File的练习)