Java中的Math.pow错误

use*_*104 3 java

我"显然"只是在学习编程,我似乎无法弄清楚要做什么才能摆脱这个错误.错误发生在第二行到最后一行 - 前一行:[System.out.print(+ windChill);]

这里(下面写的)是Java生成的"可能的提示"列表,用于我得到的错误:

**')' expected
method pow in class java.lang.Math cannot be applied to given types
  required: double,double
  found: double
method pow in class java.lang.Math cannot be applied to given types
  required: double,double
  found: double
operator + cannot be applied to double,pow
incompatible types
  required: doub...**

任何提示或澄清都将是最受欢迎的.请参阅下面的代码.先感谢您.

巴蒂尔

import java.util.Scanner;
public class Main {

   public static void main(String[] args) {
        // TODO code application logic here
        Scanner input = new Scanner(System.in);
        System.out.print("Enter a temperature between -58 and 41 degrees Fahrenheit and press ENTER");
        double temperature = input.nextDouble();
        System.out.print("Enter a wind speed that is 2 miles per hour or faster and press ENTER");      
        double windSpeed = input.nextDouble();
        double windChill = (((35.41 + temperature - Math.pow(windSpeed * 16) + Math.pow(temperature * 16)));
        System.out.print(+windChill);

    }

}
Run Code Online (Sandbox Code Playgroud)

Pra*_*rav 7

(((35.41 + temperature - Math.pow(windSpeed * 16) + Math.pow(temperature * 16)))

Math.pow需要两个参数.你只提供一个.

你的意思是Math.pow(windSpeed,16)?

Math.pow声明为 public static double pow(double a,double b) 它返回第一个参数的值,该值是第二个参数的幂.

此外,左侧还有一个额外的括号.