I have gone through Java tutorials but a confusion about arrays is still there in my mind.
How array works internally? From where the data member length
comes?(when we have to get the length of dynamic array, we usually use array.length
)
I have gone through Java tutorials but a confusion about arrays is still there in my mind.
How array works internally? From where the data member length
comes?(when we have to get the length of dynamic array, we usually use array.length
)
There is no "member function" length()
. There's a (final) property length
that tells the size of the array. Arrays are objects, but they're mainly native implemented. Basically they're pointers with bounds checking.
You don't need to worry about the internal implementation of arrays, they work just fine.