문자열에서 문자의 개수를 얻고 싶다면 length() 메소드를 사용

String subject = "자바 프로그래밍";
int length = subject.length(); //8
 
0 1 2 3 4 5 6 7

 

반응형

+ Recent posts