== (1) 썸네일형 리스트형 기초 : String 클래스 인스턴스 생성 1) new 키워드 없이 인스턴스를 만드는 경우 String str1 = "hello"; String str2 = "hello"; - 문자열이 메모리 중 상수를 저장하는 영역에 저장된다. - str1과 str2는 같은 인스턴스를 참조한다. 2) new 키워드로 인스턴스를 만드는 경우 String str1 = new String("hello"); String str2 = new String("hello"); - 인스턴스는 무조건 힙 메모리 영역에 새로 만드므로 str1과 str2는 서로 다른 인스턴스를 참조한다. package javaStudy; public class StringExam { public static void main(String[] args) { String str1 = new Strin.. 이전 1 다음