目录后如何判断遍历出来的是文件还是文件夹

2025-04-06 22:38:43
推荐回答(1个)
回答1:

如果是文件夹:file.isDirectory()必定为true
如果是文本文档 file.getName().endsWith(".txt")为true