+ 5

Java /**....*/

what is /** writing here*/ used for in java? i didnt understand it

8th Aug 2018, 11:14 PM
Hehe Haha
Hehe Haha - avatar
15 ответов
+ 8
A docblock is a /** */ comment, that's just what they are called. For example the link I posted; the source code probably looked something like /** * an ordered collection (also known as * blah blah blah) * * @author John Doe */ public class List<E> implements Collection<E>, ... { /** * Appends the specified element * blah blah blah * * @param e element to be appended * @return boolean */ public boolean add(E e) { ... } } And then javadoc created that website by reading all the docblocks (The link I gave obviously has many more methods than just add). It's nice because you have code and documentation in one place.
8th Aug 2018, 11:58 PM
Schindlabua
Schindlabua - avatar
+ 22
For multi line comments
8th Aug 2018, 11:22 PM
Vukan
Vukan - avatar
+ 5
For multi line comment you use /*... */ /**.... */ is used for something else
8th Aug 2018, 11:23 PM
Hehe Haha
Hehe Haha - avatar
+ 4
You use /** */ for docblock comments. That means you use them to describe functions or classes (in an exact format) and then there are tools like javadoc that look for /** */ in your code and generate a nice website for you, that look like this one: https://docs.oracle.com/javase/7/docs/api/java/util/List.html That's useful especially for other people who have to use your code, but also for yourself of course.
8th Aug 2018, 11:46 PM
Schindlabua
Schindlabua - avatar
+ 3
Comments in /**...*/ are used for javadoc. It is a tool for generating API documentation in HTML format. You can document packages, classes, fields, methods, constructors, etc. Nice tool, because it defines a common way for developers to communicate about their code.
8th Aug 2018, 11:52 PM
Steppenwolf
Steppenwolf - avatar
+ 2
So you write your comment and then it generates a link for you to find what exactly it means? What are dockblocks?
8th Aug 2018, 11:48 PM
Hehe Haha
Hehe Haha - avatar
+ 2
I see thanks
9th Aug 2018, 12:03 AM
Hehe Haha
Hehe Haha - avatar
+ 2
/** */ is a java doc comments. JAVADOC comments are like to display the description of a variable or method or class when mouse over on it when it is using some other area. We can identify this feature when we are developing code in eclipse IDE.
9th Aug 2018, 12:49 AM
Suman
+ 2
its nothing
9th Aug 2018, 4:46 PM
AmiR
+ 2
its a comment
9th Aug 2018, 4:47 PM
AmiR
+ 2
its for programmer
9th Aug 2018, 4:47 PM
AmiR
+ 2
nah its not multiline comment, its doc or documents comments (multiline C are being written in /*_______ */ in these
9th Aug 2018, 9:53 PM
Headshot
Headshot - avatar
+ 1
It is a multi line comment.
9th Aug 2018, 11:08 AM
Krishna Kumar
Krishna Kumar - avatar
0
Comments not write compiler
9th May 2020, 9:26 AM
ahmad iyad
ahmad iyad - avatar
0
It's standard to be used in documentation for java.
23rd Oct 2020, 4:49 PM
Nikhil Gupta
Nikhil Gupta - avatar