Every Java programmer will use the comments when writing the program, this blog is not about how to define the comments, but rather a description of the magic of the comment notation.
1 /**2 * This is a test class3 */4 Public classTest {5 /**6 * Entrance to the program7 */8 Public Static voidMain (string[] args) {9 NewTest ();Ten } One}
Here are two common multiline annotations, in the idea environment, select the method or class name, press and hold Ctrl+q (Ctrl and then move the mouse over the target) to see the comments for the corresponding target:
This allows you to see the annotation information for the corresponding target ( class or method ), but this is just a common comment, and the Magic Note is as follows:
Effect change: Font changed to Red, added an underscore, suspected link effect, font bold.
Looks like a link, a great feeling, click to see:
Into Baidu? What the hell.
.
See here, a lot of people may have guessed, yes, that's what you think, let's take a look at the comments after the change:
1 /**2 * <a href= 'http://www.baidu.com' style= ' color:red;font-weight:900: ' > This is a test class </a>3 */4 Public classTest {5 /**6 * Entrance to the program7 */8 Public Static voidMain (string[] args) {9 NewTest ();Ten } One}
See, it seems a little familiar, html+css?
Yes, the Magic feature in Java annotations is to support some of the tags in Html+css, with the above code we have changed the font to a hyperlink, and the font is set to red, the word weight 900.
Since some of the HTML+CSS tags are supported in Java annotations, you can use this approach to emphasize when writing notes that are particularly noteworthy.
Another magical use of Java annotations