次のように BigInteger を使用してみます (m と n は整数です)。
m.substract(BigInteger.ONE), n.substract(BigInteger.ONE)
それは言う:「プリミティブ型intでsubtract(BigInteger)を呼び出すことはできません」
ここで何が間違っていますか?
次のように BigInteger を使用してみます (m と n は整数です)。
m.substract(BigInteger.ONE), n.substract(BigInteger.ONE)
それは言う:「プリミティブ型intでsubtract(BigInteger)を呼び出すことはできません」
ここで何が間違っていますか?
intはネイティブ データ型であり、オブジェクトではありません!!!
たぶん、代わりにmand nasを宣言する必要がありますか?BigIntegers
m.substract(BigInteger.ONE) ここで、m は単なる anintであり、aBigIntegerでもObjectどの種類でもなく、プリミティブです。メソッド () を呼び出したい場合substract(BigInteger i)、m と n は実際にメソッドを持っているObjectものである必要があります。classsubstract(BigInteger i)
次のようにできます。
BigInteger mBig = new BigInteger(m); // in this case n is a String
mBig = mBig.subtract(BigInteger.ONE);
ところで:それは減算と呼ばれ、減算ではありません(sなし)