Annotation _cmd generates javadac

annotation:

  • Concept: Explaining the procedure. For the computer

  • Note: Use text to describe the program. For programmers

  • Definition: Annotation, also called metadata. A description of the code level. It is a feature introduced in JDK1.5 and later versions, and is at the same level as classes, interfaces, and enumerations. It can be declared in front of packages, classes, fields, methods, local variables, method parameters, etc., to explain and comment on these elements.

  • Concept description:

    • New features after JDK1.5
    • Procedural
    • Use annotation: @ Note name

cmd generates javadoc

Demo
1. Create a package in IDEA and write an AnnoDemo1 class

package annotation;

/**
 * 注解javadoc演示
 *
 * @author OnlyMI
 * @version 1.0
 * @since 1.5
 */
public class AnnoDemo1 {
    
    

    /**
     * 计算两数的和
     * @param a 整数
     * @param b 整数
     * @return 两数的和
     */

    public int add(int a,int b){
    
    
        return a + b;
    }
}

2. Create a folder on the desktop, copy and paste the class into
the folder. Open the cmd command in the folder and enter javadoc *.java -encoding UTF-8 -charset UTF-8 as shown in the figure
Insert picture description here

Insert picture description here

3. Open AnnoDemo1.html
Insert picture description here
Insert picture description here

  • Function classification:
    ①Write document: Generate document through the annotations identified in the code [Generate doc document]
    ②Code analysis: Analyze the code through the annotations identified in the code [Use reflection]
    ③Compilation check: Let the annotations in the code let The compiler can implement basic compilation checks [Override]

Guess you like

Origin blog.csdn.net/weixin_44664432/article/details/109236810
cmd