nerdexam
Oracle

1Z0-811 · Question #55

1Z0-811 Question #55: Real Exam Question with Answer & Explanation

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

Java Basics

Question

Given: public class Test { int var1; // line n1 public static void main (String[] args) { int var2; // line n2 Test obj = new Test(); int var3 = var2 - obj.var1; System.out.println (var3); } } What is the result?

Options

  • ACompilation fails. To make it compile, replace line n1 with var1 = 0;
  • BCompilation fails. To make it compile, replace line n2 with var2 = 0;
  • C0
  • DNothing is printed.

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

#variable initialization#instance vs local variables#default values#compilation rules
Full 1Z0-811 Practice
Given: public class Test { int var1; // line n1 public static void... | 1Z0-811 Q#55 Answer | NerdExam