我有简单的课
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(); }
}
}
但是当我javadoc -d c:\mypath\home\html Lab1_1.java
在 Lab1_1 html 文件中生成文档时,没有变量字段。
我的评论有什么问题?