Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import Java BigInteger

I have to do some project with the Java class BigInteger. (Representation of Rational Numbers)

The first problem occurs when I try to import it.

I can use import java.math.*;

But as soon as I use import java.math.BigInteger; the BigInteger gets marked red, and does not work anymore.

When importing it by math.* I cannot use any of the functions of BigInteger, like .valueOf or any other.

Had somebody already had this problem and found a solution?

My code so far:

import java.math.BigInteger;

public class Rational {

    private BigInteger num; //Zähler, Nummerator
    private BigInteger denom; //Nenner, denominator

    public Rational (BigInteger num, BigInteger denom) {
        this.num = num;
        this.denom = denom;
    }
}
like image 648
Meyerstim Avatar asked Aug 05 '26 02:08

Meyerstim


1 Answers

Restart IDE

Thanks to Nexevis.

It was as easy as that, stupid not to try this on my own.

Restarted IntelliJ and now it works fine.

Thanks to all the othery, trying to solve my problem.

like image 142
Meyerstim Avatar answered Aug 06 '26 16:08

Meyerstim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!