由于某种原因,即使我使用-l选项,命令提示符也没有为我提供局部变量表。有什么建议/要点吗?
编辑,这是SumSqrt类的代码:
public class SumSqrt {
/** Calculates the sum of the square roots of the elements of an array.
* @param a the array
* @return Sum (i = 0 to a.length-1) Math.sqrt(a[i])
*/
public static double sumSqrt(double[] a) {
double sum = 0.0;
for(int i = 0; i<a.length; i++) {
sum = sum + Math.sqrt(a[i]);
}
return sum;
}
public static void main(String[] args) {
double[] array = {2,10,30,44,9};
System.out.println(sumSqrt(array));
}
}