Oracle
1Z0-805 · Question #88
1Z0-805 Question #88: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-805 to reveal the answer and full explanation for question #88. The question stem and answer options stay visible for context.
Question
Given: import java.io.*; public class SampleClass { public static void main(String[] args) throws IOException { try { String dirName = args[0]; File dir = new File(dirName); File.createTempFile("temp", "log", dir); } catch (NullPointerException | IOException e) { e = new IOException("Error while creating temp file"); throw e; } } } What is the result?
Options
- ACompilation fails.
- BAn IOException with the default message is thrown at runtime.
- CAn IOException with the message Error while creating temp file is thrown at runtime.
- DA temporary file is created in the specified directory.
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.