Comments help explain your code. Java ignores them.
// This is a single-line comment
System.out.println("Hello!"); // Inline comment
/* This is a
multi-line comment */
For generating documentation:
/**
* This method calculates the sum of two numbers.
* @param a First number
* @param b Second number
* @return The sum of a and b
*/
public int add(int a, int b) {
return a + b;
}