Which of the following is a reserved Java keyword (cannot be used as an identifier)?

Difficulty: Easy

Correct Answer: native

Explanation:


Introduction / Context:
Java keywords are reserved by the language grammar. Using them as identifiers leads to compilation errors. This question targets recognition of true keywords versus ordinary words.



Given Data / Assumptions:

  • A mix of non-keywords (everyday terms) and a real Java keyword is presented.


Concept / Approach:
native is a Java keyword used to mark methods implemented in non-Java code (typically via JNI). Words like method, subclasses, reference, and array are not reserved, even though they are common terminology.



Step-by-Step Solution:

native → keyword that modifies a method declaration.method, subclasses, reference, array → not keywords; they can be used as identifiers (though not recommended for clarity).


Verification / Alternative check:
Try declaring variables with these names; only native will fail to compile as an identifier.



Why Other Options Are Wrong:
They are not part of Java’s reserved word list.



Common Pitfalls:
Confusing domain nouns with reserved language tokens.



Final Answer:
native

More Questions from Language Fundamentals

Discussion & Comments

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