|
個人試著練習了一下BigInteger的使用方法
但以下程式碼卻發生9個錯誤
import static java.lang.System.*;
import java.math.*;
public class BigInteger{
public static void main(String args[]){
BigInteger a = new BigInteger("8786567886771666523775892");
BigInteger b = new BigInteger("1126838773993333890888316");
BigInteger c = a.add(b);
out.println("a + b = " + c);
out.println("a - b = " + a.add(b.negate()));
out.println("a - b = " + a.subtract(b));
out.println("a × b = " + a.multiply(b));
out.println("a ÷ b = " + a.divide(b));
out.println("a^3 = " + a.pow(3));
out.println("gcd(a , b)" + a.gcd(b));
}
}
大致發生這3種錯誤:
constructor BigInteger in class BigInteger cannot be applied to given types;
actual and formal argument lists differ in length
error: cannot find symbol
向各方高手 求解 謝謝 |
|