Java Comments
Comments in Java
There are three types of comment supported in Java.
- Single-line,
- Multiline and
- Documentation comment.
Single-line comment
Java single line comment starts from //
and ends till the end of that line.
public class Main {
// This is a single line comment.
public static void main(String[] argv) {
}//w w w . j av a 2 s .c o m
}
Multiline comment
Java multiline comment is between /*
and */
.
Everything from /*
through */
is ignored by the compiler.
public class Main {
/* This //from w w w. ja va 2 s . co m
is
a
Multiline
comment.
*/
public static void main(String[] argv) {
}
}