What is the difference between == & .equals()?

What is the difference between == & .equals()?

The == and eqauls() method, both are used to check the equality of the two strings, but in the different sense.

The eqauls() method put the two strings in the two different arrays and compare the characters one by one.

 If all the characters are matched then this method will return true otherwise false.

The == operator checks whether the two strings points to the same the object or not. The == operator checks the bit pattern of the two references.


By:Jalees
Date:2011-01-09 00:00:00

The == and eqauls() method, both are used to check the equality of the two strings, but in the different sense.

The eqauls() method put the two strings in the two different arrays and compare the characters one by one.

 If all the characters are matched then this method will return true otherwise false.

The == operator checks whether the two strings points to the same the object or not. The == operator checks the bit pattern of the two references.


By:Sumit Tripathi
Date:2018-05-15 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher