nerdexam
Oracle

1Z0-819 · Question #20

1Z0-819 Question #20: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-819 to reveal the answer and full explanation for question #20. The question stem and answer options stay visible for context.

Question

Given:
package test;

import java.time.*;

public class Diary {
 private LocalDate now = LocalDate.now();

 public LocalDate getDate() {
 return now;
 }
}
and
package test;

public class Tester {
 public static void main(String[] args) {
 Diary d = new Diary();
 System.out.println(d.getDate());
 }
}
Which statement is true?

Options

  • AClass Tester does not need to import java.time.LocalDate because it is already visible to members of the package test.
  • BAll classes from the package java.time.*, are loaded to the class Diary.
  • CBoth classes need to be in the java.time package to work.
  • DTester must import java.time.LocalDate in order to compile.

Unlock 1Z0-819 to see the answer

You've previewed enough free 1Z0-819 questions. Unlock 1Z0-819 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.

Full 1Z0-819 Practice