ICSE Class 9 Computer Applications Question 4 of 13

Input in Java — Question 4

Back to all questions
4
Question

Question 4

How can you write single line comments in Java?

Answer

Single line comments in Java can be written in the below two ways:

  1. Using Single line comments style — Single line comment begin with a double slash (//) and continues till the end of the line. For example:
// Single line comment example
  1. Using Multi line comments style — In this style, comments start with the initiating slash-asterisk (/*) and ends with the terminating asterisk-slash(*/). For example:
/* Single line comment using multi line comment style */