Skip to content
Advertisement

I can’t insert more than 10 digit of integer type of data in java

I had a problem by my code. How to insert more than 10 digits of integer, I have searched and can be done by using BigInteger, but I don’t know how to use it in my code using “System.in”

JavaScript

can someone help me? thank you before This is my code This my error

Advertisement

Answer

Simply because int max value is limited to 10 digits. You can use long instead as you can add upto 19 digits. Listed below is the difference of Integer and Long max and min values.

JavaScript

In your code, just simply replace with the following.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement