adplus-dvertising
frame-decoration

Question

What is the output of this program?
    class output 
    {
        public static void main(String args[])
        { 
           String s1 = "Hello i love java";
           String s2 = new String(s1);
           System.out.println((s1 == s2) + " " + s1.equals(s2));
        }
    }

a.

true true

b.

false false

c.

true false

d.

false true

Posted under Java Programming

Answer: (d).false true

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?