I read in the JVM specification that the data types byte,short and char are internally treated as int. So why having these data types if we don't have a benefit from their small size?
In part it's for compatibility with C/C++, and in part it's to conserve memory - internally, a short is stored as a short, but it's processed as an integer. A new short[10]
takes up half as much memory as a new int[10]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With