What is the difference between multi-line comment /* */ and documentation comment /** */ in Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

What is the difference between multi-line comment /* */ and documentation comment /** */ in Java?

/* this is a multi-line comment */ /** this is an important multi-line comment */

14th Aug 2019, 3:17 AM
Safaa Alnabhan
Safaa Alnabhan - avatar
5 Answers
+ 3
Comments like /** .. */ are for javadoc tool (included in Java installation) which automatic generate html documentation for your codes with this comments as headers for next class or methods. like https://pasteboard.co/IsBtgbe.png or https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/lang/String.html
14th Aug 2019, 5:06 AM
zemiak
+ 3
Standard multi-line comments won't show up in Javadoc.
14th Aug 2019, 7:41 AM
Sonic
Sonic - avatar
+ 2
About static method to java?
17th Jan 2020, 10:18 AM
kani
kani - avatar
+ 1
Use // text when you want to commenta single line of code. Use /* text */when you want to comment multiple lines of code. Use /** documentation */ when you would want to add some info about the program that can be used for automatic generation of program documentation.
28th Aug 2019, 6:10 AM
Maheedhar Vegesana
Maheedhar Vegesana - avatar
+ 1
multi-line is to use multiple lines. And documentation comment is to attach some file by the comment.
28th Aug 2019, 7:32 PM
Wesley