I'm new to Eclipse and I'm using for some Android development. Eclipse is making me increasingly aware of poor habits I've formed (I.E. not capitalizing class names, etc.).
One thing I've noticed is that when I use the //
characters to comment, the text turns green, but when I use the /** **/
characters, the text turns light blue. Is there a reason for this? Some type of comment specification that I missed somewhere? Are these supposed to serve as different functions for different types of comments?
I'm running Helios Service Release 1 (Build 20100917-0705) for Win 7(x64) if that makes any difference.
Java supports two types of comments: /* multiline comment */ : The compiler ignores everything from /* to */ . The comment can span over multiple lines. // single line : The compiler ignores everything from // to the end of the line.
Java programs can have two kinds of comments: implementation comments and documentation comments. Implementation comments are those found in C++, which are delimited by /*... */, and //. Documentation comments (known as "doc comments") are Java-only, and are delimited by /**...
In Java there are three types of comments:Single-line comments. Multi-line comments. Documentation comments.
Block comments that start with /**
in java are javadoc comments. Eclipse colors them differently to set them apart from normal comments.
Here's a guide that discusses how to write documentation comments for java: http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html
When you hover over a class/method/field that has a javadoc comment in Eclipse, you'll see a little documentation popup that contains a formatted version of the javadoc comment for that class/method/field.
You can also use the javadoc command-line tool to generate HTML documentation for your packages and classes. When you do this, the tool uses the javadoc comments in your source code to build the documentation.
Eclipse comment defaults:
//
and /* .. */
are standard comments and show up in one color, green
/** ...... **/
are javadoc comments and show up in a different color, blue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With