Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
非常に基本的な質問がありますが、どういうわけか混乱しています。通常、ファイルとディレクトリの両方の存在を確認するには、ブール値を使用して確認できますfile.exists() が、指定されたパスがディレクトリかファイルかを判断できる方法はありますか?
file.exists()
Javaを使用した短い例を提供できれば幸いです。
はい、ドキュメントから、メソッドisFileとisDirectory
isFile
isDirectory
isDirectoryとisFileを使用できます。