How can i get this program running well | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can i get this program running well

i tried to implement a getFactorial method using BigInteger but i get some compiler exceptions https://code.sololearn.com/c59YkpgVVMn7/?ref=app

8th Feb 2019, 7:26 PM
Mind To Machine 💻🕆
Mind To Machine 💻🕆 - avatar
2 Answers
+ 3
1. Import BigInteger class from math: import java.math.BigInteger; 2. You need to return a BigInteger, because you can't convert type int to BigInteger: return n.equals(0) ? 1 : n.multiply(...); return n.equals(new BigInteger("0")) ? new BigInteger("1") : n.multiply(...);
8th Feb 2019, 8:18 PM
Boris Batinkov
Boris Batinkov - avatar
+ 1
Boris Batinkov thanks alot bro...it worked
8th Feb 2019, 8:33 PM
Mind To Machine 💻🕆
Mind To Machine 💻🕆 - avatar