I was wondering what the /** hello */
in Java was for. The only reason I currently use them is because I like how it shows up blue in Eclipse and I'm to lazy to change colors in my preferences. I've noticed when I automatically add stuff like serialVersionUID
's it puts /** * */
right above it, but what is it actually for?
Asked
Active
Viewed 1,525 times
-1

John S.
- 626
- 1
- 4
- 16
-
http://www.oracle.com/technetwork/articles/java/index-137868.html – Marc B Jan 14 '16 at 21:26
-
@freakshow1217 While I generally agree with that statement for many questions... in this case, what would you suggest he used as a google search term? Googling for "/**" or "java /**" aren't particularly productive and if he knew to google for "javadoc" he wouldn't have needed to. Is there some search term he should have thought of that I'm also not thinking of here? – mah Jan 14 '16 at 21:30
-
1You can quite often get useful results just searching for the names of the special characters. I get a useful answer if I search for "Java slash two asterisks." – resueman Jan 14 '16 at 21:31
-
@resueman cool, I didn't know google would manage that. – mah Jan 14 '16 at 21:33
1 Answers
6
Such comment as
/** hello */
is a JavaDocs comment, means that if you hover the element to whom you attached this comment & pressed Ctrl+Q (in IntelliJ IDEA e.g), you shall get your "hello"
comment as a definition. It's like if you're building your own documentation (for that function or property).
While
/* regular comment */
is just a regular comment.

Mohammed Aouf Zouag
- 17,042
- 4
- 41
- 67
-
2thanks, when I try to google it, it just seems to search it without the non-alpha-numerical characters. – John S. Jan 14 '16 at 21:29