1.length:
是一個 屬性
針對的是 數組
得到的結果是 數組的長度
eg: String [] array = {"abc","def","ghi"};
System.out.println( array.length );
=====> 3
2.length():
是一個 方法
針對的是 字符串
獲取的是 字符串的長度
eg: String [] array = {"abc","def","ghi"};
String s = "abcdef";
System.out.println( array[0].length() );
System.out.println( s.length() );
=====> 3 6
3.size():
是一個 方法
針對的是 泛型集合
獲取的是 集合的元素個數
eg: List<Object> list = new ArrayList();
list.add("aaa");
System.out.println( list.size() );
=====> 1
