Which of the following are keywords or reserved words in Java?
-
if
-
then
-
goto
-
while
Reveal answer
Fill a bubble to check yourself
B
Correct answer
AI explanation
To answer this question, let's go through each option to understand why it is correct or incorrect:
Option A) if - This option is a keyword in Java. The "if" keyword is used to specify a condition in an if statement.
Option B) then - This option is incorrect. "Then" is not a keyword or reserved word in Java.
Option C) goto - This option is incorrect. "Goto" is not a keyword or reserved word in Java.
Option D) while - This option is a keyword in Java. The "while" keyword is used to create a while loop, which repeatedly executes a block of code as long as a given condition is true.
The correct answer is B. "Then" is not a keyword or reserved word in Java.