Oracle
1Z0-851 · Question #18
1Z0-851 Question #18: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #18. The question stem and answer options stay visible for context.
Question
Given that the current directory is empty, and that the user has read and write permissions, and the following: import java.io.*; public class DOS { public static void main(String[] args) { File dir = new File("dir"); dir.mkdir(); File f1 = new File(dir, "f1.txt"); try { f1.createNewFile(); } catch (IOException e) { ; } File newDir = new File("newDir"); dir.renameTo(newDir); } } Which statement is true?
Options
- ACompilation fails.
- BThe file system has a new empty directory named dir.
- CThe file system has a new empty directory named newDir.
- DThe file system has a directory named dir, containing a file f1.txt.
- EThe file system has a directory named newDir, containing a file f1.txt.
Unlock 1Z0-851 to see the answer
You've previewed enough free 1Z0-851 questions. Unlock 1Z0-851 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.