Java MCQ: Which of the following is not a reserved keyword in Java?
a) const
b) goto
c) implements
d) sizeof
Answer:
d) sizeof
Explanation:
The sizeof
keyword is not a reserved keyword in Java. It is used in C and C++ to determine the size of a data type or variable, but Java does not have this keyword.
In Java, the size of primitive data types is predefined (e.g., int
is always 32 bits), so there is no need for a sizeof
operator. Other options like const
and goto
are reserved in Java, but they are not used. The implements
keyword is used to indicate that a class implements an interface.
Understanding Java’s reserved keywords and their roles helps in avoiding syntax errors and writing correct Java programs.
Reference links:
https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html