Hi. I'm trying to use BigIntegers (I need them, normal Integers aren't enough) and multiply two BigIntegers but I get just errors. Also, I'm not really so sure about creating BigInteger values, so if I have something wrong, could you please tell me what I'm doing wrong. So here is my problematic code:
---------------------------------------------------------------------------
public static void main(
String[] args) {
Scanner nappaimisto;
nappaimisto = new Scanner (System.in);
System.out.println("Anna luku 1:");
BigInteger luku1 = new BigInteger(nappaimisto.nextBigInteger());
System.out.println("Anna luku 2:");
BigInteger luku2 = new BigInteger(nappaimisto.nextBigInteger());
BigInteger tulo = new BigInteger.multiply(luku1, luku2);
System.out.println("Lukujen " + luku1 + " ja" + luku2 + " tulo on " + tulo);
}
---------------------------------------------------------------------------
I'm getting these errors:
---------------------------------------------------------------------------
Kertolasku.java:32: cannot find symbol
symbol : constructor BigInteger(java.math.BigInteger)
location: class java.math.BigInteger
BigInteger luku1 = new BigInteger(nappaimisto.nextBigInteger());
^
Kertolasku.java:34: cannot find symbol
symbol : constructor BigInteger(java.math.BigInteger)
location: class java.math.BigInteger
BigInteger luku2 = new BigInteger(nappaimisto.nextBigInteger());
^
Kertolasku.java:35: cannot find symbol
symbol : class multiply
location: class java.math.BigInteger
BigInteger tulo = new BigInteger.multiply(luku1, luku2);
^
3 errors
---------------------------------------------------------------------------
I've imported Scanner and BigInteger classes. I have also tried to read
Java API etc. but this problem doesn't seem to solve just with my skills.