我的程序中出现错误:
Lyrics.java:11:错误:找不到符号
Run Code Online (Sandbox Code Playgroud)Cube(b); ^符号:方法Cube(int)
location:class歌词
Lyrics.java:15:错误:不兼容的类型:从double到int的可能有损转换
Run Code Online (Sandbox Code Playgroud)return Math.pow (b, 3); ^2个错误
我在网站上四处看看,结果发现其他人也有这个问题,但我看了评论,我仍然不明白这个问题,我的代码中没有双重为什么会这样说.而且我也没有找不到错误,说找不到符号.请帮助我真的被困在这一段时间了.
import static java.lang.Math.pow;
import java.util.Scanner;
public class Lyrics
{
public static void main(String []args)
{
int b;
Scanner scan = new Scanner(System.in);
System.out.println ("Enter a number: ");
b = scan.nextInt();
Cube(b);
}
public static int cube (int b)
{
return Math.pow (b, 3);
}
}
Run Code Online (Sandbox Code Playgroud)