How Java provides implementation of Array internally?

175 Views Asked by At

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)

1

There are 1 best solutions below

2
Kayaman On

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.