public class _03_StringCompare {
public static void main(String[] args) {
//๋ฌธ์์ด ๋น๊ต
String s1 = "Java";
String s2 = "Python";
System.out.println(s1.equals("Java")); //๋ฌธ์์ด ๋ด์ฉ์ด ๊ฐ์ผ๋ฉด true, ๋ค๋ฅด๋ฉด false
System.out.println(s2.equalsIgnoreCase("python")); //๋์๋ฌธ์ ๊ตฌ๋ถ ์์ด ๋ฌธ์์ด ๋ด์ฉ์ด ๊ฐ์์ง ์ฌ๋ถ ์ฒดํฌ
//๋ฌธ์์ด ๋น๊ต ์ฌํ
s1 = "1234"; //๋ฒฝ์ ๋ถ์ ๋ฉ๋ชจ์ง์ ๋น๋ฐ๋ฒํธ ์ ๋ณด
s2 = "1234";
System.out.println(s1.equals(s2)); //true (๋ด์ฉ)
System.out.println(s1 == s2); //true (์ฐธ์กฐ)
s1 = new String("1234");
s2 = new String("1234");
System.out.println(s1.equals(s2)); //true
System.out.println(s1 == s2); //false
}
}