Computer Applications

Which of the following is a valid java keyword?

  1. If
  2. BOOLEAN
  3. static
  4. Switch

Values & Data Types Java

ICSE Sp 2025

5 Likes

Answer

static

Reason — In Java, keywords are reserved words that have a specific meaning and purpose in the language. Keywords must always be written in lowercase. Analysing the given options:

  1. If: Incorrect because Java keywords are case-sensitive, and the correct keyword is if (in lowercase).
  2. BOOLEAN: Incorrect because the keyword in Java is boolean (in lowercase).
  3. static: Correct. static is a valid Java keyword used to declare static methods, variables, or blocks.
  4. Switch: Incorrect because the correct keyword is switch (in lowercase).

Answered By

3 Likes


Related Questions