Introduction to Java


A comment is text you want Java to ignore. Comments allow you to describe code or keep notes.

By using comments in the Java code, you may help yourself and even other programmers understand the purpose of code that a comment refers to.

In Java, there are two styles of comments: single line comments and multi-line comments.

  1. Single line comments are one line comments that begin with two forward slashes:
// I'm a single line comment!
  1. Multi-line comments are generally longer comments that can span multiple lines. They begin with /* and end with */ . Here's an example:


Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.