EN
Java - get array size
4
points
In java every array has property .length
not a method .length()
or .size()
.
Examples:
int[] intArray = new int[3];
int length = intArray.length; // 3
int[] intArray = {1, 2, 3};
int length = intArray.length; // 3
String[] stringArray = new String[3];
int length = stringArray.length; // 3
String[] stringArray = {"A", "B", "C"};
int length = stringArray.length; // 3