Which of the following is a valid java keyword?
Advertisements
Question
Which of the following is a valid java keyword?
Options
If
BOOLEAN
static
Switch
MCQ
Advertisements
Solution
static
Explanation:
Keywords in Java are reserved terms with a defined meaning and purpose within the language. Keywords should always be written in lowercase. Analyzing the provided options:
If:Incorrect because Java keywords are case-sensitive; the correct keyword is if (lowercase).BOOLEAN:Incorrect because the Java keyword is boolean (lowercase).static:This is correct; static is a valid Java keyword for declaring static methods, variables, or blocks.Switch:Incorrect since the right keyword is switch (lowercase).
shaalaa.com
Tokens
Is there an error in this question or solution?
