-5

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.

ajay
  • 135
  • 1
  • 1
  • 9

1 Answers1

2

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.

Zach
  • 4,652
  • 18
  • 22