此方法是查找输入的双参数的平方根。它的输出与参数相同。
public class JavaApplication5 {
public static String calculateSqaureRoot(double radicand){
Math.sqrt(radicand);
NumberFormat DecimalLimter = NumberFormat.getNumberInstance();
DecimalLimter.setMaximumFractionDigits(3);
return DecimalLimter.format(radicand);
}
public static void main(String[] args) {
System.out.println(calculateSqaureRoot(4.00));
}
}
答案 0 :(得分:3)
你忽略了返回值。变化
Math.sqrt(radicand);
到
radicand = Math.sqrt(radicand);
答案 1 :(得分:2)