Java - Array's length property
Posted
by
The New Idiot
on Stack Overflow
See other posts from Stack Overflow
or by The New Idiot
Published on 2012-02-15T17:10:22Z
Indexed on
2013/06/28
10:21 UTC
Read the original article
Hit count: 256
We can determine the length of an ArrayList<E>
using its public method size()
, like
ArrayList<Integer> arr = new ArrayList(10);
int size = arr.size();
Similarly we can determine the length of an Array
object using the length
property
String[] str = new String[10];
int size = str.length;
Whereas the size()
method of ArrayList
is defined inside the ArrayList
class , where is this length
property of Array
defined ? Is it implemented by JVM or does it reside in any Java API
class file ?
© Stack Overflow or respective owner