public class StringDenmo {
public static void main(String[] args) {
String s1 = new String("HelloWorld");
String s2 = new String("HelloWorld");
System.out.println(s1 == s2);
System.out.println(s1.equals(s2));
String s3 = new String("HelloWorld")
String s4 = "HelloWorld";
System.out.println(s3 == s4);
System.out.println(s3.equals(s4));
String s5 = "HelloWorld";
String s6 = "HelloWorld";
System.out.println(s5 == s6);
System.out.println(s5.equals(s6));
}
}
public class StringDemo {
public static void main(String[] args) {
String s1 = "Hello";
String s2 = "World";
String s3 = "Helloworld";
System.out.println(s3 == s1 + s2);
System.out.println(s3.equals(s1 + s2));
System.out.println(s3 == "Hello" + "World");
System.out.println(s3.equals("Hello" + "World"));
}
}