The array does not have the length () method and has the length property. String has the length () method.
1.String string
String str = "ABCDEFG";
Str.length ();
2.Array arrays
int[] arr = new INT[10];
System.out.println (arr.length);
3.List Collection
List List = new ArrayList ();
List.size ();
4.JSONArray
String jsonmessage =
"[{' num ': ' Score ', ' foreign language ': 88, ' history ': 65, ' geography ': ' The ' object ': {' AAA ': 1111, ' BBB ': 2222, ' CCC ': ' 3333 '}, '
+ "{' num ': ' Interest ', ' foreign language ': 28, ' history ': 45, ' geography ': +, ' object ': {' AAA ': 1a11, ' BBB ': 2a22, ' CCC ': ' 3a33 '}, '
+ ' {' num ' : ' Interest ', ' foreign language ': 48, ' History ': 62, ' geography ': ' The ', ' object ': {' AAA ': 1aaa, ' BBB ': 2bb2, ' CCC ': ' 3c33 '}] ";
jsonarray myjsonarray = Jsonarray.fromobject (jsonmessage);
for (int i = 0; i < ; i++)
{
//Traverse
}
Original Length properties of strings, arrays, collections, and Jsonarray in Java