+ 1
Is it necessary to write multiple lines of comment when we use multi line comment code? Can we write 1 line comment in /* */?
3 ответов
+ 3
No, it isn't necessary I also use /* */ if I'm writing a comment inside of a line.
0
you can always use /* */,
and in java you can use the convention
/**
*/
for the comments to be interpreted by javadoc.
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
*/