Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
A comment is a piece of text in a program's source code that is not executed as part of the program but provides information or explanations for human readers. It is used to temporarily disable a piece of code without removing it from the program.
Related terms
Inline Comment: An inline comment is a type of comment that is placed on the same line as the code it refers to, providing additional explanation about that specific line.
Block Comment: A block comment is a type of comment that can span multiple lines, allowing for longer explanations or disabling larger sections of code.
Documentation Comment: A documentation comment is used to automatically generate documentation for the program, usually containing detailed descriptions of classes, methods, and variables.