Loading
Java Keywords and Identifiers

Q1.

Which of the following is a valid identifier in Java?

A. 123name

B. my-variable

C. _name

D. class

Q2.

Which of the following is a Java keyword?

A. integer

B. String

C. void

D. then

Q3.

What is the rule for naming identifiers in Java?

A. Identifiers can start with a number.

B. Identifiers can include special characters like @ and %.

C. Identifiers can start with a letter, $, or _.

D. Identifiers can contain spaces.

Q4.

How many keywords are reserved in Java (as of Java 17)?

A. 48
B. 50
C. 67
D. 70

Q5.

 Which of the following statements is TRUE?

A. Java keywords are case-insensitive.

B. Identifiers and keywords are both case-sensitive.

C. Identifiers cannot start with an underscore.

D. Java allows spaces in identifiers.