Exam 1z0-811 All QuestionsBrowse all questions from this exam
Question 8

Given the code fragment:

Which statement is true?

    Correct Answer: D

    The code will not compile because the Random class, ArrayList class, and List interface are part of the java.util package, which needs to be explicitly imported. The Math class is part of the java.lang package, which is automatically imported. Therefore, importing java.util.* at the beginning of the code will resolve the compilation errors.

Discussion
LionNishOption: D

The correct answer is D

darius123Option: D

The correct answer is D. Random has to be imported explicitly from java.util.*

tombatossalsOption: D

Correct answer is D. We must import Random, ArrayList and List from java.util

filco72

public static void main(String[] args)

filco72

It does not compile because of a syntax error in main method declaration: use parentheses instead of curly braces

tabrezshaikh13Option: D

D is the correct answer.

falchettoOption: D

java.lang.Math has to be imported in order to use Math.PI, correct answer is D