package string; public class Demo2_String { public static void main(String[] args) { String st1 = "abc"; String st2 = "abc"; System.out.println(st1 == st2); System.out.println(st1.equals(st2)); } }
String st1 = new String(“abc”);
package string; public class Demo2_String { public static void main(String[] args) { String st1 = new String("abc"); String st2 = "abc"; System.out.println(st1 == st2); System.out.println(st1.equals(st2)); } }
package string; public class Demo2_String { public static void main(String[] args) { String st1 = "a" "b" "c"; String st2 = "abc"; System.out.println(st1 == st2); System.out.println(st1.equals(st2)); } }
package string; public class Demo2_String { public static void main(String[] args) { String st1 = "ab"; String st2 = "abc"; String st3 = st1 "c"; System.out.println(st2 == st3); System.out.println(st2.equals(st3)); } }