Given that the current directory is empty, and that the user has read and write permissions, and the following:
1. import java.io.*;
2. public class DOS {
3. public static void main(String[] args) {
4. File dir = new File(“dir”);
5. dir.mkdir();
6. File f1 = new File(dir, “f1.txt”);
7. try {
8. f1.createNewFile();
9. } catch (IOException e) { ; }
10. File newDir = new File(“newDir”);
11. dir.renameTo(newDir);
12. }
13. }
Which statement is true?
A.
Compilation fails.
B.
The file system has a new empty directory named dir.
C.
The file system has a new empty directory named newDir.
D.
The file system has a directory named dir, containing a file f1.txt.
E.
The file system has a directory named newDir, containing a file f1.txt.
Explanation: