• Java基础-注释


    java注释是不被编译器和解释器执行的语句。用于有关变量,方法,类或其他任何语句的解释。也可以隐藏程序代码。

    java有三种注释:

    1. 单行注释   //This is single line comment

    2. 多行注释  /* This is multi line comment */

    3. 文档注释  /** This is documentation comment */

    例子:

    /** The Calculator class provides methods to get addition and subtraction of given 2 numbers.*/  
    public class Calculator {  
    /** The add() method returns addition of given numbers.*/  
    public static int add(int a, int b){return a+b;}  
    /** The sub() method returns subtraction of given numbers.*/  
    public static int sub(int a, int b){return a-b;}  
    }  
    View Code

    对于文档注释,通过一下步骤可以生产html文档,功能相当强大

    javac Calculator.java

    javadoc Calculator.java

  • 相关阅读:
    char 转string
    博客,记忆的图谱。
    history
    openstack Icehouse发布
    数据库常用命令
    nagios
    screen
    openstack 流量控制
    sublime 3
    磁盘类型
  • 原文地址:https://www.cnblogs.com/yuan1225/p/8252429.html
Copyright © 2020-2023  润新知