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

相关文章:

  • 2021-04-02
  • 2021-09-25
  • 2022-12-23
  • 2021-04-09
  • 2021-07-07
  • 2021-11-08
  • 2021-06-01
  • 2022-02-25
猜你喜欢
  • 2021-04-24
  • 2021-09-09
  • 2021-06-12
  • 2022-12-23
  • 2021-12-18
  • 2022-01-28
  • 2022-01-24
相关资源
相似解决方案