Java OCA OCP Practice Question 733

Question

Which starts counting from one rather than zero?

  • A. Array indexes
  • B. The index used by charAt() in a String
  • C. The months in a LocalDateTime
  • D. The months in a LocalTime


C.

Note

In Java, most things use zero-based indexes, including arrays and a String.

Months are an exception to this convention starting Java 8.

This makes the answer either Option C or D.

LocalTime does not contain date fields, so it has to be Option C.




PreviousNext

Related