CCA Guide
Commenting

Commenting

Curated by Last modified: 1 min read

View Markdown

Single-line comments (rems)

Text after // is a comment until the end of that line.

System.out.println("Hello!"); // This line prints "Hello!"

Block comments (block rems)

Use /* ... */ for a comment spanning multiple lines.

public class HelloWorld {
    /* This is my first line
       This is my second line
       Goodbye! */

    public static void main(String[] args) {
        System.out.println("Wow!");
    }
}

Related: Introduction to Java

Linked to this page