In java, suppose we have
int[] a=new int[4];
then how can we find the length/size of a?a.size() and a.length() are not working.
In java, suppose we have
int[] a=new int[4];
then how can we find the length/size of a?a.size() and a.length() are not working.
Use a.length
to find the length of an array. This is not a method and that is why a.length()
does not work. a.length()
is for Strings though.