Oracle
1Z0-805 · Question #37
1Z0-805 Question #37: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-805 to reveal the answer and full explanation for question #37. The question stem and answer options stay visible for context.
Question
Given the code fragment: public static void main(String[] args) { String source = "d:\company\info.txt"; String dest = "d:\company\emp\info.txt"; //insert code fragment here Line ** } catch (IOException e) { System.err.println ("Caught IOException: " + e.getmessage(); Oracle 1Z0-805 Exam } } Which two try statements, when inserted at line **, enable the code to successfully move the file info.txt to the destination directory, even if a file by the same name already exists in the destination directory?
Options
- Atry {FileChannel in = new FileInputStream(source).getChannel(); FileChannel out = new FileOutput
- Btry {Files.copy(Paths.get(source), Paths.get(dest));
- Ctry {Files.copy(Paths.get(source), Paths.get(dest));
- Dtry {Files.move(Paths.get(source),Paths.get(dest));
- Etry {BufferedReader br = Files.newBufferedReader(Paths.get(source), Charset.forName ("UTF- 8"));
Unlock 1Z0-805 to see the answer
You've previewed enough free 1Z0-805 questions. Unlock 1Z0-805 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.