storing the values | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

storing the values

which type of variable used to store the value 654644

14th Aug 2017, 11:42 AM
ROSHAN SHETTY
ROSHAN SHETTY - avatar
4 Answers
+ 1
if you just want to store it , String can help you too.
17th Aug 2017, 1:10 PM
R1100
R1100 - avatar
+ 6
According to the following reference, int and any type greater than int can hold this number +---------+------+-------+-------+ | types | size | min | max. | | | (bits) | value | value | +---------+------+-------+-------+ | byte | 8 | -128 | 127 | +---------+------+-------+-------+ | char | 16 | 0 | 2^16 | | | | | - 1 | +---------+------+-------+-------+ | short | 16 | -2^15 | 2^15 | | | | | - 1 | +---------+------+-------+-------+ | int | 32 | -2^31 | 2^31 | | | | | - 1 | +---------+------+-------+-------+ | long | 64 | -2^63 | 2^63 | | | | | - 1 | +---------+------+-------+-------+ | float | 32 | 2^ | (2 - 2^ | | | | -148 | -23) * | | | | | 2^127 | +---------+------+-------+-------+ | double | 64 | 2^ | (2 - 2^ | | | | -1074 | -52) * | | | | | 2^1023| +---------+------+-------+-------+ | boolean | 1 | -- | -- | +---------+------+-------+-------+ | void | -- | -- | -- | +---------+------+-------+-------+
14th Aug 2017, 11:48 AM
Babak
Babak - avatar
+ 1
int64
14th Aug 2017, 11:47 AM
Melih Melik Sonmez
Melih Melik Sonmez - avatar
+ 1
654644 is an Integer type value, because it's higher than Short.MAX_VALUE and lower than Integer.MAX_VALUE. So you should use int or long.
14th Aug 2017, 12:37 PM
Boris Batinkov
Boris Batinkov - avatar