How does Java calculate length of primitive array? -
this question has answer here:
- where array's length property defined? 6 answers
code:
char[] chars = "abcd".tochararray(); system.out.println(chars.length);
question: how length calculate java here? since char not class, not sure length stored. if isn't stored, calculated every time chars.length? (i presume not)
the thing wrote char[]
object, array, , has public final field called length
. calculated once when array in created. objects has tostring(), notify()
, etc...
Comments
Post a Comment