Programming Concepts Question:
Explain what is the use of == and equals() method?

Answer:
The == operator compare whether two object references are refer to the same instance or not.
The equals() method compare the characters(contents) of two String object.
example:
String a="Hai";
String b="Hai";
String c=new String("Hai");
System.out.println(a==b); //True
System.out.println(a==c); //False
System.out.println(a.equals(b)); //True
System.out.println(a.equals(c)); //True
The equals() method compare the characters(contents) of two String object.
example:
String a="Hai";
String b="Hai";
String c=new String("Hai");
System.out.println(a==b); //True
System.out.println(a==c); //False
System.out.println(a.equals(b)); //True
System.out.println(a.equals(c)); //True