Computer Applications
Which of the following is a valid java keyword?
- If
- BOOLEAN
- static
- Switch
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:
If: Incorrect because Java keywords are case-sensitive, and the correct keyword isif(in lowercase).BOOLEAN: Incorrect because the keyword in Java isboolean(in lowercase).static: Correct.staticis a valid Java keyword used to declare static methods, variables, or blocks.Switch: Incorrect because the correct keyword isswitch(in lowercase).
Related Questions
The size of '\n' is:
- 2 bytes
- 4 bytes
- 8 bytes
- 16 bytes
Identify the operator that gets the highest precedence while evaluating the given expression:
a + b % c * d - e
- +
- %
- -
- *
The output of the following code is:
System.out.println(Math.ceil(6.4) + Math.floor(-1-2));- 3.0
- 4
- 3
- 4.0
Which of the following returns a String?
- length()
- charAt(int)
- replace(char, char)
- indexOf(String)