-
What is the output of this program?
public class output
{
public static void main(String args[])
{
String str1 = "Hello i love interview mania";
String str2 = new String(str1);
System.out.println((str1 == str2) + " " + str1.equals(str2));
}
}
-
- false true
- true false
- true
- false
- None of these
Correct Option: A
The == operator compares two object references to see whether they refer to the same instance, where as equals() compares the content of the two objects.