Question 1
Given the code fragment:

What is the result?

What is the result?
Question 2
Given the code fragment:

What is the result?

What is the result?
Question 3
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 Projectscontains subdirectories that contain .classfiles and is passed as an argument to the recDelete ()method when it is invoked.
What is the result?
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 Projectscontains subdirectories that contain .classfiles and is passed as an argument to the recDelete ()method when it is invoked.
What is the result?
Question 4
Given the code fragment:
Map<Integer, String> books = new TreeMap<>();
books.put (1007, "A");
books.put (1002, "C");
books.put (1001, "B");
books.put (1003, "B");
System.out.println (books);
What is the result?
Map<Integer, String> books = new TreeMap<>();
books.put (1007, "A");
books.put (1002, "C");
books.put (1001, "B");
books.put (1003, "B");
System.out.println (books);
What is the result?
Question 5
Given the code fragment:

Which statement can be inserted into line n1 to print 1,2; 1,10; 2,20;?

Which statement can be inserted into line n1 to print 1,2; 1,10; 2,20;?