1 2 3 4 5 6 7 8 9 10 11 12 13 | String str1 = "hello"; String str2 = "hell"; str2 = str2 + "o"; System.out.println(str2); // hello로 출력 if (str1==str2) { System.out.println("같다"); // 같다고 인식하지 않음 } if (str1.equals(str2)) { System.out.println("같습니다"); // 같다고 인식함 } | cs |
'JAVA > F' 카테고리의 다른 글
[자바] String 관련 함수/메소드 (0) | 2020.10.13 |
---|---|
[자바] 비어있는지 확인하는 함수 / isEmpty() (0) | 2020.10.12 |
[자바] 앞 뒤 스페이스 / 공백 제거 함수 : trim() (0) | 2020.10.12 |
[자바] Math.abs() / 절대값 함수 (0) | 2020.10.07 |
[자바] 대문자를 소문자로, 소문자를 대문자로 바꿔주기 (0) | 2020.09.28 |
[자바] String을 Int로 , Int를 String으로, String으로 변환 parseint / tostring (0) | 2020.09.24 |
[자바] 랜덤함수 / Math.random() (0) | 2020.09.24 |