Which one of the following lists contains only valid Java language keywords (no identifiers or non-Java tokens)?

Difficulty: Easy

Correct Answer: goto, instanceof, native, finally, default, throws

Explanation:


Introduction / Context:
Knowing Java’s keyword set helps avoid using reserved words as identifiers and recognizes special meaning in code. Trick options often include almost-correct items (e.g., Int vs. int) or non-Java words.



Given Data / Assumptions:

  • We must select a list where every token is a Java keyword.


Concept / Approach:
Valid keywords include goto (reserved but unusable), instanceof, native, finally, default, throws. Non-keywords: Int (wrong case), virtual (not in Java), constant (not a keyword), include (not in Java). assert is a keyword since Java 1.4, but option E includes include, invalidating the entire set.



Step-by-Step Solution:

Option B → all six are keywords → correct.Option A → Int is not a keyword; should be lowercase int.Option C → virtual is not a Java keyword.Option D → constant is not a keyword (const exists but is reserved, not constant).Option E → include is not a Java keyword (C/C++ preprocessor concept).


Verification / Alternative check:
Consult any official list or attempt to compile variables named after these tokens.



Why Other Options Are Wrong:
Each contains at least one non-keyword.



Common Pitfalls:
Case sensitivity (Int vs. int) and language crossover terms like include or virtual.



Final Answer:
goto, instanceof, native, finally, default, throws

More Questions from Language Fundamentals

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion