1Z0-829 Utilizing Java Object-Oriented Approach Practice Question
Exhibit
public class Outer {
private int x = 10;
class Inner {
private int x = 20;
void method() {
int x = 30;
System.out.println(x);
System.out.println(this.x);
System.out.println(Outer.this.x);
}
}
public static void main(String[] args) {
Outer.Inner inner = new Outer().new Inner();
inner.method();
}
}Refer to the exhibit. What is the output?
⚠ Common exam trap
Watch out — candidates often confuse push() with add() (which adds to the tail) and assume the iteration order matches insertion order, rather than recognizing that push() places elements at the front for LIFO access.
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
✓
30 20 10
The code uses a Deque (ArrayDeque) and calls push() to add elements, which adds them to the front of the deque (LIFO order). The for-each loop iterates from the head (first) to the tail (last), so it prints 30, 20, 10. Option B is correct because push() behaves like a stack, and iteration follows the deque's head-to-tail order.
Go deeper
Related to this question
About these practice questions
One of 513 original 1Z0-829 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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-829 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-829 exam.