[JAVA] String 클래스의 특징
·
Language/Java
먼저 String 클래스가 무엇인지 간단히 알아보자. String은 자바가 제공하는 클래스 중에서 문자열을 다루는 클래스다. String 클래스의 객체를 생성하는 방법은 두 가지가 있는데, new 키워드 통해 생성자의 입력 매개변수로 문자열을 전달하는 방법과 문자열 리터럴 방법이 있다. String text1 = new String("new 키워드"); // new 키워드 String text2 = "리터럴"; // 문자열 리터럴 이때 두 가지 방법 모두 메모리에 저장되는 방식은 동일하다. String은 참조 자료형이기 때문에 실제 데이터(문자열)는 힙 메모리에 위치하고, 참조 변수 text1은 힙 메모리의 데이터를 가리키게 된다. String 클래스는 다른 클래스와는 다르게 두 가지의 특징이 있다. ..
[JAVA] 직렬화(Serialization)란?
·
Language/Java
이번에 채팅 앱 프로젝트를 진행하면서, Redis를 사용하게 되었습니다. public class RedisTemplate extends RedisAccessor implements RedisOperations, BeanClassLoaderAware { /** * Sets the key **serializer** to be used by this template. Defaults to {@link #getDefaultSerializer()}. * @param serializer the key serializer to be used by this template. */ public void setKeySerializer(RedisSerializer serializer) { this.keySerializer ..