package com.lixing.base02;
import java.util.Arrays;
import java.util.List;
/**
* @author: ZH
* @date: 2019/11/23 17:13
* @description: length length() size()区别
*/
public class LengthTest {
public static void main(String[] args) {
int[] a = {1, 2, 3};
System.out.println(a.length);
String str ="123";
System.out.println(str.length());
List list = Arrays.asList(1, 2, 3);
System.out.println(list.size());
//output
//3
//3
//3
//ZH总结 一开始的char[]肯定是length 没有括号的,String 不过是char[]扩展 就是 length()
//集合类肯定就另外是size()
}
}
网友评论