length
배열의 길이를 알고자 할 때
length()
문자열의 길이를 알고자 할때
size()
컬랙션 프레임워크의 길이를 알고자 할 때
package Lengh_Lengh_Size;
import java.util.ArrayList;
public class Java_LengthCheckStudy {
public static void main(String[] args){
Length_study();
StringLength_study();
Size_Study();
}
public static void Length_study(){
int[] lengthStudy = new int[7];
System.out.println("length > "+lengthStudy.length);
}
public static void StringLength_study(){
String lengthStudy = "I want Java Master";
System.out.println("length() > "+lengthStudy.length());
}
public static void Size_Study(){
ArrayList<String> sizeStudy = new ArrayList<>();
sizeStudy.add("아크로");
System.out.println("add한 길이 > "+ sizeStudy.size());
sizeStudy.remove(0);
System.out.println("remove 길이 > "+ sizeStudy.size());
}
}
'개발 > Java' 카테고리의 다른 글
[Map] TreeMap 이론 및 코드 정리 (0) | 2021.05.26 |
---|---|
LinkedHashMap 이론 및 코드 정리 (0) | 2021.05.26 |
Hashtable 이론정리 (0) | 2021.05.26 |
[Map] HashMap 이론 및 코드 (0) | 2021.05.26 |
[Java] List 컬렉션 (0) | 2021.05.22 |