带有命令行参数的Math.pow

Ŧhų*_*nDö 1 java math command-line

我需要用户获取给定数字的功率值(作为命令行参数)

这是我的代码,它出现了编译错误.

谁能帮帮我吗 ?

class SquareRoot{

      public static void main(String args []){

          double power = Math.pow(args[0]);         
          System.out.println("Your squared value is " + power);

      }
}
Run Code Online (Sandbox Code Playgroud)

Yog*_*h_D 5

Math.pow 接受两个args,你必须从命令行中取两个数字或者有一个"硬编码".

这是签名:

public static double pow(double a, double b)
Run Code Online (Sandbox Code Playgroud)