Is it necessary to write multiple lines of comment when we use multi line comment code? Can we write 1 line comment in /* */? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it necessary to write multiple lines of comment when we use multi line comment code? Can we write 1 line comment in /* */?

18th Jun 2018, 7:15 PM
Prabhat Rai
Prabhat Rai - avatar
3 Answers
+ 3
No, it isn't necessary I also use /* */ if I'm writing a comment inside of a line.
18th Jun 2018, 7:23 PM
Michael55555
Michael55555 - avatar
0
you can always use /* */, and in java you can use the convention /** */ for the comments to be interpreted by javadoc.
18th Jun 2018, 8:45 PM
ifl
ifl - avatar
0
It is ok to use /* */ anywhere you like, however note that this type of comment cannot be nested: you can't have : /* This code is /*commented*/ this code is not commented */ so I usually use // for one line comments, so that I can easily comment out large blocks of code if needed (e.g. when troubleshooting) example: /* Some //fully //commented code */
18th Jun 2018, 8:51 PM
ifl
ifl - avatar