Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- OS
- 운영체제
- SystemCall
- 쓰레드 라이브러리
- 프로세스
- django-crontab
- java.util.function
- AOP
- hiberbate
- Process
- Spring
- 함수형 인터페이스
- 도커
- python-socketio
- rainbow table
- @Header
- task_struct
- strict stubbing
- Thread Multiplexing
- functional interface
- Thread Library
- spring-data-jpa
- FunctionalInterface
- custom annotation
- 롬복주의점
- sql-mappler
- 문자열 리터럴
- ReflectUtils
- none이미지
- 문자열 불변성
Archives
- Today
- Total
목록문자열 불변성 (1)
JH's Develog

자바를 공부하다 보면 문자열 리터럴은 불변이라는 점이 많이 강조됩니다. String str1 = "Kim"; str1 = str1 + "Lee"; 즉 위와 같은 경우에 str1에 할당된 "Kim"이라는 문자열 리터럴이 "KimLee"로 변하는 것이 아니라, str1은 새로 생성된 "KimLee"라는 문자열을 가리키도록 변하는 것입니다. String str1 = "Kim"; String str2 = "Kim"; System.out.println(str1 == str2); // True! ※ 만약 같은 내용의 문자열을 가리키는 두 변수가 서로 다른 주솟값을 가지게 하고 싶다면 str2 = new String("Kim") 과 같이 new 연산자를 사용해서 할당해주면 됩니다. 또한 같은 문자열 리터럴 값을 가지..
JAVA
2022. 1. 14. 09:34