Oracle
1Z0-811 · Question #8
1Z0-811 Question #8: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-811 to reveal the answer and full explanation for question #8. The question stem and answer options stay visible for context.
Java Basics
Question
Given the code fragment:
//line n1
public class App {
public static void main(String[] args) {
List<Double> nums = new ArrayList<>();
nums.add(Math.PI);
nums.add(new Random().nextDouble());
}
}
Which statement is true?
Options
- AThe code results in a compilation error. To make it compile, insert at line n1: import java.lang.Math; import java.lang.Random; import java.util;
- BThe code compiles successfully
- CThe code results in a compilation error. To make it compile, insert at line n1: import java.lang; import java.util;
- DThe code results in a compilation error. To make it compile, insert at line n1: import java.util.*;
Unlock 1Z0-811 to see the answer
You've previewed enough free 1Z0-811 questions. Unlock 1Z0-811 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.
Topics
#imports#java.lang#java.util#package visibility