the == operator checks whether two reference variable refer to the same object.that is whether two variable refer to the same bit
pattern .whereas the equals operator checks for the content
Eg
1
String a=new String("Java");
String b=a;
if we say
a==b than
this will return true
Eg 2
String a=new String("java") ;
String b=new String("java");
now when we say
a==b
this will return false
But for the same if we say
a.equals(b)
it will return true
=============
key point to remember == can be used to compare variable refering to the same bit pattern
and equals is used to check the content of a reference variable
you cannot use equals for two different object
it will always return false if we use it for two different objects.