求助:怎样在自己的类里面定义BigInteger类型的属性
我想在Fraction类里面有两个BigInteger类型的属性,下列代码应该怎么改:
import java.math.BigInteger;
class Fraction{
public BigInteger numerator,denominator;
public Fraction(){
BigInteger aaaa = new BigInteger(0);
BigInteger bbbb = new BigInteger(1);
this.numerator = aaaa;
this.denominator = bbbb;
}
}
------解决方案--------------------
哦,是这样的:BigInteger的构造函数是private的,这样写:
this.numerator = BigInteger.valueOf(0);