What will be the output of the following Java code?

class output 
   {
       public static void main(String args[])
       { 
          String s1 = "Hello";
          String s2 = new String(s1);
          String s3 = "HELLO";
          System.out.println(s1.equals(s2) + " " + s2.equals(s3));
       }
   }

a) true true
b) false false
c) true false
d) false true

1 thought on “What will be the output of the following Java code?”

Leave a Comment