Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (13.1k points)
Can anyone help me what is the difference between == operator and .equals() in Java? Why I cannot able to use == operator while comparing strings? Can anyone help me with this?

1 Answer

0 votes
by (26.7k points)

Basically, == operator helps you with the reference equality like both the objects are same or not whereas .equals() helps you with the value equality like both the objects are logically equal or not. 

I hope this will help.

Want to become a Java expert? join Java Certification now!!

Want to know more about Java? Watch this video on Learn Java | Java Programming for Beginners:

Browse Categories

...