首页 文章

二元运算符的坏操作数类型

提问于
浏览
-1

我需要一个最多20位的大数字,我正在使用bigint . 它给了我这个错误(二元运算符的坏操作数类型)在线下面 .

BigInteger t = new BigInteger(my_number.getText().toString());
                my_number.setText(String.valueOf(t+1));

2 回答

  • 2

    Java不支持运算符重载 . 使用 add 方法: t.add(BigInteger.ONE)

  • 1
    BigInteger bi = new BigInteger("12223");
     BigInteger cvk =  new BigInteger("1");
     System.out.println(String.valueOf(bi.add(cvk)));
    

    希望我的帮助有效 .

相关问题