How does Java calculate length of primitive array? -


this question has answer here:

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

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -