English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

hi, i'm trying to multiply one biginteger object by another, but my code is not working! does anyone know what i need to do to get this compiling!
thanks to anyone who helps!

class BigIntegerDemo {

public static void main(String[] args) {
System.out.print(multiply(new BigInteger("2000000"), new BigInteger("10000")));
}

BigInteger multiply(BigInteger b1, Biginteger b2) {
return b1.multiply(b2);
}
}

2007-10-29 03:09:28 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

2 answers

What do you mean by not working?
Post the error?


- K

2007-10-29 03:11:58 · answer #1 · answered by kiddo 2 · 1 0

It is your multiply that is wrong. Check the signature of the method and you will find that it only takes one parameter. The other parameter is from the object that multiply is applied to.

So...

bI= new BigInteger("2000000")
System.out.print(bI.multiply(new BigInteger("10000")));

2007-10-29 03:25:02 · answer #2 · answered by AnalProgrammer 7 · 2 1

fedest.com, questions and answers