public class Main {
public static void main(String[] args) {
String str1 = "Programming";
String str2 = "Programming";
String str3 = new String("Programming");
System.out.println(str1==str2);
System.out.println(str1==str3);
System.out.println(str1.equals(str3));
System.out.print(str2.equals(str3));
}
}
// str1, str2는 같은 값이기떄문에 같은 주소를 바라 (String Pool 주소)
// == : 주소까지 확인
// equals : 값 확인
To embed this project on your website, copy the following code and paste it into your website's HTML: