Want to assign 12 digits number in a long type variable error: integer number too large: 100000000000 long no = 100000000000;
long no = 100000000000;
Want to assign 12 digits number in a long type variable error: integer number too large: 100000000000 long no = 100000000000;
long no = 100000000000;
You need to treat the literal as a long as well using "L" at the end of the number:
long no = 100000000000L;
Without the literal, the number is treated as an int.
This is because by default every constant number you're assigning to a variable is seen as an int. To make your example work, you need to add an "L" at the end of the number.
long no = 10000...L;