1Z0-811 Java Basics and Syntax Practice Question
Which TWO of the following are valid Java identifiers?
⚠ Common exam trap
The 1Z0-811 exam often tests the misconception that underscores and dollar signs are not valid identifier characters, or that keywords can be used as identifiers if they are not used in a keyword context, but the rule is absolute: reserved words cannot be identifiers.
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
✓
_count
(_count) is a valid Java identifier because identifiers can begin with an underscore (_) or a dollar sign ($), and can contain letters, digits, underscores, and dollar signs. Java allows underscores as the first character, though this is discouraged in modern Java style guides.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
class
Why it's wrong here
Invalid. Reserved word.
- ✗
2ndValue
Why it's wrong here
Invalid. Starts with digit.
- ✓
_count
Why this is correct
Valid. Underscore is allowed.
- ✗
my-var
Why it's wrong here
Invalid. Hyphen not allowed.
- ✓
$dollar
Why this is correct
Valid. Dollar sign is allowed.
Go deeper
Related to this question
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 →
Same concept, more angles
1 more way this is tested on 1Z0-811
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. Which THREE are valid Java identifiers?
easy- A.2ndValue
- ✓ B.my_value
- ✓ C.$dollar
- D.my-var
- ✓ E._myVar
Why B: (my_value) is a valid Java identifier because it starts with a letter (m) and contains only letters, digits, and underscores. Java identifiers must begin with a letter, underscore, or dollar sign, and subsequent characters can include letters, digits, underscores, or dollar signs.
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.