+ 4
How much Bytes?
in java. if i declare integer variable it occupies 32 bytes. it does not matter what value i put in this variable. if i put 200 or 2, it does not effect variable's memory. if i am wrong plz correct me. and explain. sorry for bad English. edited. 32 bits not 32 bytes. thank u Michal, for correction
3 Respuestas
+ 3
int is 32 bits, not 32 bytes
it does not depend on the value in the variable
it will be always 32 bits = 4 bytes
+ 4
(meta) Why? Because it's faster to retrieve aligned data (you know it's always a certain distance away) than arbitrarily-sized data (must do a full scan).
+ 1
Yes that is correct. In most languages a type of variable occupies a certain constant amount of bytes.