Question: I'm trying to print a large integer in java but it is giving me a compiling error which is: error: integer number too large: 9999999999999
I'm trying to print a large integer in java but it is giving me a compiling error which is:
error: integer number too large: 9999999999999
this is how I initialized the number:
long c = 9999999999999;
my question is why is it not working with "long" data type knowing that long can hold up to 19 digits?
to be specific, long can hold up to: 9223372036854775807
I know that there is a BigInteger class that I can import and use it but my question is why is it not working with long?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
