Q:
What will be the output of the following code snippet?
Object s1 = new String("Hello");
Object s2 = new String("Hello");
if(s1 == s2) {
System.out.println("s1 and s2 are ==");
}else if (s1.equals(s2)) {
System.out.println("s1 and s2 are equals()");
}
Answer
Answer : s1 and s2 are equals()
Explanation :

View answer
Workspace
Report Error
Discuss