O

Java SE 8 Programmer II

196 Questions

You can start the exam to practice all questions related to this exam.

Question No. 1

Given the code fragment:
public void recDelete (String dirName) throws IOException {
File [ ] listOfFiles = new File (dirName) .listFiles();
if (listOfFiles ! = null && listOfFiles.length >0) {
for (File aFile : listOfFiles) {
if (aFile.isDirectory ()) {
recDelete (aFile.getAbsolutePath ());
} else {
if (aFile.getName ().endsWith (“.class”))
aFile.delete ();
}
}
}
}
Assume that Projects contains subdirectories that contain .class files and is passed as an
argument to the recDelete () method when it is invoked.
What is the result?

Choose the correct option from the given list.
01 / 196

0 Discussions

Trending Exams