java - byte z[] = new byte[5]; - What does this mean? -
this question has answer here:
- difference between int[] array , int array[] 25 answers
i'm trying head around piece of code found. firstly, i'm not sure why code appears like:
byte z[] = new byte[5];
instead of:
byte[] z = new byte[5];
i mean, byte z[] not there declare array of bytes? or code doing else?
secondly, why choose bytes on doubles or ints. seems byte number -128 127. what's point in choosing on double?
byte[] z equivalent byte z[] 2 different methods of represent same.
note java code conventions of sun (before becoming oracle) propose use first on second. preferreable use
byte[] z = new byte[5]; instead of
byte z[] = new byte[5]; for second part of question.
byte uses 1 byte char uses 2 bytes int uses 4 bytes long uses 8 bytes so best use smallest numeric type avoid memory occupancy.
Comments
Post a Comment