Courseiva
Object-Oriented ProgrammingeasyMultiple ChoiceObjective-mapped

1Z0-811 Object-Oriented Programming Practice Question

Exhibit

javac Test.java
Test.java:5: error: cannot find symbol
    System.out.println(value);
                        ^
  symbol:   variable value
  location: class Test

Refer to the exhibit.

What is the likely cause?

⚠ Common exam trap

Oracle often tests the difference between 'undeclared', 'out of scope', and 'uninitialized' by presenting an error message that could be interpreted in multiple ways, and the trap is that candidates confuse 'undeclared' with 'out of scope' because both produce a 'cannot find symbol' error, but only the former means the variable was never declared at all.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The variable 'value' is not declared

The error message indicates that the variable 'value' has not been declared before use. In Java, every variable must be declared with a type and name before it can be referenced. The compiler cannot find a declaration for 'value' in the current scope, so it reports a 'cannot find symbol' error, which is the typical symptom of an undeclared variable.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The package is missing

    Why it's wrong here

    A missing package would cause a different error, not 'cannot find symbol'.

  • The variable 'value' is not declared

    Why this is correct

    The error indicates that the symbol 'value' cannot be found, meaning it is not declared in the class.

  • The class name is misspelled

    Why it's wrong here

    A misspelled class name would cause a different error.

  • The variable 'value' is out of scope

    Why it's wrong here

    A scope issue would typically produce a different error, but if not declared, it's not a scope issue.

  • The variable 'value' is declared but not initialized

    Why it's wrong here

    An uninitialized variable would cause a 'variable might not have been initialized' error, not 'cannot find symbol'.

About these practice questions

One of 481 original 1Z0-811 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.