Java: Display all PDF files in a directory and subdirectories etc...? I have the
ID: 3752776 • Letter: J
Question
Java: Display all PDF files in a directory and subdirectories etc...?
I have the code that asks the user for a directory, then displays every file in that directory; however, say I want to display only the pdf files in the directory (and all subdirecteries etc..), how would I go about doing that? I'm trying to do this recursively as well. It is not required, but can you leave somewhat of a description of your code whether it be comments or just a description underneath your reply? Will leave a thumbs up!
Here is the code so far:
Explanation / Answer
else if(file.getName().endsWith("pdf")){
Syso(file.getAbsolutePath())
}
Replace else part with
The block like above
U should ist check if file is pdf then only display that
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.