`
哈达f
  • 浏览: 114954 次
  • 性别: Icon_minigender_1
  • 来自: 广西
社区版块
存档分类
最新评论

File类使用

    博客分类:
  • j2se
 
阅读更多
import java.io.*;
class  FileDemo
{
	public static void main(String[] args) throws IOException
	{
		
		File f1 = new File("c:\\qqqq.txt");

		File[] arr = File.listRoots();
		for(File f : arr)
		{
			System.out.println(f);
		}

//		f.createNewFile();
		/*
		if(f.exists() )
		{
			if(f.isFile())
			{
				
			}
			else
			{
				
			}
		}
		*/
//		System.out.println(f.isFile()+",,,"+f.isDirectory());
//		boolean b = f.exists();
//		System.out.println(b);
//		System.out.println(f.getAbsolutePath()+"....."+f.getPath());

	}
}
/*
File(String p,String c)
{
	this(new File(p),c);
}

File(File p,String c)
{

}

String getAbsolutePath()
{
	return "c:\\a.txt";
}

File getAbsoluteFile()
{
	return new File(getAbsolutePath());
}
*/

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics