Comments
Comments record information for people reading the source. The compiler ignores them, so they never become part of the program's output.
Use // for the rest of one line. Use /* and */ around a longer block. Good comments explain a decision or a constraint that the code itself cannot make obvious.
Comments stay in the source
public class Main {
public static void main(String[] args) {
// This score came from the last round
System.out.println("Score: 91");
// Scores are out of 100
}
}
Output:
Score: 91
Both comments remain in the source while only the score reaches standard output.
Do not use comments to rescue unclear names. score is easier to maintain than x // current score.
Keep two fuel notes in the source while printing only the useful value below.