-
What is the output of this program?
public class stringClass_Example
{
public static void main(String args[])
{
String str = "Interview";
String str1 = "Mania";
String str2 = "Interview";
System.out.println(str.equals(str1) + " " + str.equals(str2));
}
}
-
- true true
- false false
- false true
- true false
- None of these
Correct Option: C
equals() is method of class String, it is used to check equality of two String objects, if they are equal, true is retuned else false.
output: false true