There are two types of comments in Java:
- Single-line Comments – start with
//. - Multi-line Comments – enclosed between
/*and*/.
Source Code:
public class comments {
/**
* Method main
*
*
* @param args
*
*/
public static void main(String[] args) {
// TODO: Add your code here
int x = 10;
int y = 20;
System.out.println("x + y = "+(x + y)); // Output: 30
}
}Result:
Watch the video:

