Java如何判断文件夹是否存在?

如题所述

方法如下:

public static void judeDirExists(File file)

if (file.exists())             if (file.isDirectory())                

System.out.println("dir exists");          }

else                 System.out.println("the same name file exists, can not create dir");             }41      

else             System.out.println("dir not exists, create it ...");             、

file.mkdir();

Java是一种可以撰写跨平台应用软件的面向对象的程序设计语言。Java 技术具有卓越的通用性、高效性、平台移植性和安全性,广泛应用于PC、数据中心、游戏控制台、科学超级计算机、移动电话和互联网,同时拥有全球最大的开发者专业社群。

温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网