我正在關注一本關於java的書,我嘗試運行此代碼,並在所有數學方法中找到了未找到符號的錯誤,儘管Math已包含在標準Java庫中。未找到數學方法符號
public class Math{
public static void main(String[] args){
double root = Math.sqrt(17.0);
double angle = 1.5;
double height = Math.sin(angle);
double radians = Math.toRadians(180);
double degrees = Math.toDegrees(Math.PI);
long round = Math.round(Math.PI * 30);
System.out.println("Root: " + root);
System.out.println("Angle: " + angle);
System.out.println("Height: " + height);
System.out.println("Radians: " + radians);
System.out.println("Degrees: " + degrees);
System.out.println("Round: " + round);
}
}
重新命名類或使用Java'Math'類的完全限定名稱 – Rogue