1Z0-811 · Question #3
Identify two Java reserved words.
The correct answer is B. true. true is a Java reserved literal - along with false and null, it is built into the language specification and cannot be used as an identifier. Notably, this (C) is also a Java reserved word (it references the current object instance), so the full correct answer to "identify two"…
Question
Options
- Aarray
- Btrue
- Cthis
- Dexception
How the community answered
(34 responses)- A3% (1)
- B88% (30)
- C6% (2)
- D3% (1)
Explanation
true is a Java reserved literal - along with false and null, it is built into the language specification and cannot be used as an identifier. Notably, this (C) is also a Java reserved word (it references the current object instance), so the full correct answer to "identify two" is B and C.
The distractors work like this: array (A) is not a Java keyword - Java uses bracket syntax (int[]) rather than a dedicated array keyword, unlike some other languages. exception (D) is not reserved either; the relevant Java class is Exception (capitalized), which is a standard library class, not a language keyword.
Memory tip: If you can use it as a variable name without a compile error, it's not a reserved word. Try int true = 1; - the compiler rejects it immediately, confirming true is reserved. A quick mental check: Java's reserved words appear in most IDE editors highlighted in bold or a distinct color.
Topics
Community Discussion
No community discussion yet for this question.