【问题标题】:How to check if a certain .txt file exists in java [duplicate]如何检查java中是否存在某个.txt文件[重复]
【发布时间】:2017-05-06 10:12:30
【问题描述】:

我正在制作的程序将访问 words.txt 文件。 如何使用java.io 以编程方式检查该文件是否存在?

【问题讨论】:

  • 也许 File.exists ?

标签: java io


【解决方案1】:

使用File.exists()

File f = new File("filepath");
System.out.println(f.exists());

【讨论】:

    猜你喜欢
    • 2012-01-25
    • 2014-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-04
    • 2019-08-05
    相关资源
    最近更新 更多