AP-Computer-Science ScienceAP
Commenting Commenting
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