Courseiva
Question 258 of 481
Java Basics and SyntaxhardMultiple ChoiceObjective-mapped

1Z0-811 Java Basics and Syntax Practice Question

A class has a static variable counter initialized to 0. Two threads increment counter 1000 times each using counter++. What is a possible final value of counter?

⚠ Common exam trap

Oracle often tests the misconception that `counter++` is atomic, leading candidates to incorrectly choose 2000, when in fact the non-atomic nature allows any value between 1000 and 2000 due to lost updates.

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

Any value between 1000 and 2000 inclusive

`counter++` is not an atomic operation; it consists of three steps: read, increment, and write. When two threads execute this non-atomic operation concurrently without synchronization, interleaving can cause lost updates, resulting in a final value that is less than 2000 but at least 1000 (since each thread increments at least once). The possible final value is any integer between 1000 and 2000 inclusive.

Answer analysis

Option-by-option breakdown

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

  • 1000

    Why it's wrong here

    Too low; both threads perform increments.

  • 0

    Why it's wrong here

    Impossible because each thread increments counter.

  • 2000

    Why it's wrong here

    Theoretical maximum but not guaranteed due to race condition.

  • Any value between 1000 and 2000 inclusive

    Why this is correct

    Actual range due to race condition.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.