Java OCA OCP Practice Question 827

Question

Which of the following is a valid code comment in Java? (Choose three.)

  • A. / Insert */ in next method /
  • B. / Find the kitty cat */
  • C. // Is this a bug?
  • D. / Begin method - performStart() /
  • E. /* TODO: Call grandma */
  • F. # Updated code by Patti


B, C, E.

Note

The /* */ syntax can have additional * characters in Java, making Options B and E correct.

Option C is the standard way to comment a single line with two slashes //.

Option A contains a */ in the middle of the expected comment, making the part after the comment Insert / invalid.

Option D is incorrect because a single slash / is not valid comment in Java.

The # is not a comment character in Java, so Option F is incorrect.




PreviousNext

Related