我上了简单的课

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(); }
}
}

但是,当我在文件Lab1_1 html中生成文档javadoc -dc:\\mypath\\home\\html Lab1_1.java ,没有变量字段。 在此处输入图片说明

我的评论有什么问题?

===============>>#1 票数:3 已采纳

默认情况下,Javadoc将忽略私有字段和方法。 为了使其生成文档,还要在命令行上传递-private参数。 另请参见Java Javadoc include Private

  ask by lapots translate from so

未解决问题?本站智能推荐: