java / beginner
Snippet
Basic Code Comments
Comments are non-executable lines used to document code logic. Single-line comments start with '//', while multi-line comments are enclosed between '/*' and '*/'.
snippet.java
1
2
3
// This is a single-line comment/* This is a multi-linecomment block */
Breakdown
1
// This is a single-line comment
Everything after '//' on this line is ignored by the compiler.
2
/* ... */
Everything between these markers is ignored, even across multiple lines.