OCA Java SE 8 Building Blocks - OCA Mock Question Building Block 5


Which of the following are valid Java identifiers? (Choose all that apply)

  1. A$B
  2. _helloWorld123abc
  3. true
  4. java.lang
  5. Public
  6. 2016_s


A, B, E.


A is valid since dollar sign is valid identifiers.

B is valid since an underscore is valid identifiers.

C is not a valid identifier since true is a Java reserved word.

D is not valid since . is not allowed in identifiers.

E is valid because Java is case sensitive, so Public is not a reserved word.

F is not valid because the first character is not a letter, $, or _.