🐤 length
array.length -> 배열의 길이 구할 때 사용
int[] array = new int[10];
System.out.println(array.length); // 출력 : 10
🐤 size()
list.size() -> collection 타입의 사이즈를 구할때 필요하다.(ArrayList)
List<Integer> l = new ArrayList<Integer>();
l.add(1);
l.add(2);
System.out.println(l.size()); // 출력 : 2
'🐤 study > Java' 카테고리의 다른 글
[Java] ObjectMapper란? | 직렬화, 역직렬화 | Jackson 라이브러리 | Serialize, Deserialize | Json Parsing (0) | 2022.07.28 |
---|---|
[Java] 에러처리 | Try-catch | 컴파일 오류, 런타임 오류, 논리 오류 | 예외처리 방법 | checked, unchecked exception | 예외 우선순위 (0) | 2022.07.23 |
[Java] HashMap정리 (0) | 2022.02.15 |
[Java] 정규식 정리 (0) | 2022.02.02 |
[Java] ArrayList<Integer>를 int[]로 변환하는 방법 (0) | 2022.01.28 |