[์ดํํฐ๋ธ ์๋ฐ] Item6. ๋ถํ์ํ ๊ฐ์ฒด ์์ฑ์ ํผํ๋ผ.
item06. ๋ถํ์ํ ๊ฐ์ฒด ์์ฑ์ ํผํ๋ผ. โ๏ธ ์ฌ๊ธฐ์ ์ฃผ์ํ ์ ์ ๊ทธ๋ฅ ๊ฐ์ฒด ์์ฑ์ ํผํ๋ผ! ๊ฐ ์๋๋ผ๋ ์ ์ด๋ค. 1) ๋ฌธ์์ด public static void main(String[] args) { String hello = "hello"; String hello2 = new String("hello"); // ์ด ๋ฐฉ๋ฒ์ ๊ถ์ฅํ์ง ์์! -> ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๋ง์ด ์ฌ์ฉํ๋ ๋จ์ String hello3 = "hello"; System.out.println("hello == hello2 = " + (hello == hello2)); System.out.println("hello == hello3 = " + (hello == hello3)); } ๋ฌธ์์ด์ ์ฌ์ฉํ ๋๋ ๋ณดํต ์ฒซ๋ฒ์งธ, ์ธ๋ฒ์งธ ๋ฐฉ์์ฒ๋ผ ๋ฌธ์์ด ๋ฆฌํฐ..
2023.01.18