Java 类的文档中没有变量
我有简单的课程Java 类的文档中没有变量,java,javadoc,Java,Javadoc,我有简单的课程 import java.io.PrintStream; /** * Calculate roots of polynom ax^2 + bx + c = 0 * @author XXXX aka XXX * @version 1.0 17.04.2013 */ public class Lab1_1 { /** * quadratic coefficient */ private float a; /** * linear coefficient */ private
import java.io.PrintStream;
/**
* Calculate roots of polynom ax^2 + bx + c = 0
* @author XXXX aka XXX
* @version 1.0 17.04.2013
*/
public class Lab1_1 {
/**
* quadratic coefficient
*/
private float a;
/**
* linear coefficient
*/
private float b;
/**
* free term
*/
private float c;
/**
*
* Constructor Lab1_1
*
* @param a {@link Lab1_1#a}
* @param b {@link Lab1_1#b}
* @param c {@link Lab1_1#c}
*/
public Lab1_1(float a, float b, float c) {
this.a = a;
this.b = b;
this.c = c;
}
/**
* Calculate roots of quadratic equation
*
* @return returns string representation of roots of the polynom
* @throws ArithmeticException in case of complex number result
*/
public String calculate() {
float discriminant = b * b - 4 * a * c;
if (discriminant > 0) {
double result1 = (-b + Math.sqrt(discriminant)) / (2 * a);
double result2 = (-b - Math.sqrt(discriminant)) / (2 * a);
return "x1 = " + result1 + ";" + "x2 = " + result2;
} else if (discriminant == 0) {
double result = -b / (2 * a);
return "x1 = " + result + ";" + "x2 = " + result;
} else throw new ArithmeticException("Discriminant is less than zero! The result is a complex number!");
}
public static void main(String[] args) {
try{
if (args.length < 3) {
new PrintStream(System.out, true, "UTF-8").println("Number of input arguments is less than 3");
return;
}
try{
new PrintStream(System.out, true, "UTF-8").
println(
new Lab1_1(Float.parseFloat(args[0]),Float.parseFloat(args[1]),Float.parseFloat(args[2])).
calculate());
}catch(ArithmeticException e) {
System.out.println(e.getMessage());
}
}
catch(Exception e) { e.printStackTrace(); }
}
}
导入java.io.PrintStream;
/**
*计算多项式的根ax^2+bx+c=0
*@author XXXX又名XXX
*@version 1.0 17.04.2013
*/
公共类Lab1_1{
/**
*二次系数
*/
私人浮动a;
/**
*线性系数
*/
私人浮动b;
/**
*自由期
*/
私有浮动c;
/**
*
*构造函数Lab1_1
*
*@param a{@link Lab1#u 1#a}
*@param b{@link Lab1#u 1#b}
*@param c{@link Lab1#u 1#c}
*/
公共Lab1_1(浮点数a、浮点数b、浮点数c){
这个a=a;
这个.b=b;
这个.c=c;
}
/**
*求二次方程的根
*
*@return返回多项式根的字符串表示形式
*@在出现复数结果时引发算术异常
*/
公共字符串计算(){
浮点数鉴别器=b*b-4*a*c;
如果(判别式>0){
双结果1=(-b+数学sqrt(判别式))/(2*a);
双结果2=(-b-数学sqrt(判别式))/(2*a);
返回“x1=“+result1+”;“+”x2=“+result2;
}如果(判别式==0){
双结果=-b/(2*a);
返回“x1=“+result+”;“+”x2=“+result;
}否则抛出新的算术异常(“鉴别器小于零!结果是一个复数!”);
}
公共静态void main(字符串[]args){
试一试{
如果(参数长度<3){
新的PrintStream(System.out,true,“UTF-8”).println(“输入参数的数量小于3”);
返回;
}
试一试{
新的打印流(System.out,true,“UTF-8”)。
普林顿(
新的Lab1_1(Float.parseFloat(args[0])、Float.parseFloat(args[1])、Float.parseFloat(args[2])。
计算());
}捕获(算术异常){
System.out.println(e.getMessage());
}
}
catch(异常e){e.printStackTrace();}
}
}
但是当我在文件Lab1_1 html中生成documentationjavadoc-dc:\mypath\home\html Lab1_1.java
时,没有变量字段
我的评论有什么不对?Javadoc默认情况下会忽略私有字段和方法。要使其为这些对象生成文档,请在命令行上传递
-private
参数。另请参见Javadoc默认情况下将忽略私有字段和方法。要使其为这些对象生成文档,请在命令行上传递-private
参数。另见