1Z0-811 Java Basics and Syntax Practice Question
Exhibit
public class Test {
public static void main(String[] args) {
int x = 10;
int y = x++;
System.out.println(y);
}
}Refer to the exhibit. What is the output?
⚠ Common exam trap
Oracle often tests the candidate's attention to the exact condition in the `if` statement, tricking those who assume the condition is true without verifying the actual comparison value.
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
✓
10
The code initializes x to 10. The if condition is false (10 is not greater than 15), so the increment is skipped. Therefore, x remains 10, and the output is 10.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
11
Why it's wrong here
Incorrect. The condition is false, so x is not incremented; output is not 11.
- ✓
10
Why this is correct
Correct. The condition (10 > 15) is false, so the increment statement is skipped, and x remains 10.
- ✗
0
Why it's wrong here
Incorrect. The value of x is not 0; it was initialized to 10 and not changed.
- ✗
9
Why it's wrong here
Incorrect. The value is not 9; x starts at 10 and is not decremented.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 1Z0-811 question from scratch — 481 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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.