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?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…