Comments

Comments #

There are two ways to write comments in Java.

Single-line Comments #

Single-line comments in Java start with two forward slashes // and end at the end of the line.

// This is a comment
System.out.println("Hello world!");

Multi-line Comments #

Multi-line comments in Java start with /* and end with */ characters.

/* This comment
   is multi-line. */
System.out.println("Hello world!");