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

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

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
115
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Ranjeet
Publisher
πŸ“ˆ
95%
Success Rate