Q. What will be the output of the following Java code?

Code:
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
πŸ’¬ Discuss
βœ… Correct Answer: (D) false true

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
82
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Pooja
Publisher
πŸ“ˆ
92%
Success Rate