Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 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:

Related questions

0 votes
1 answer
0 votes
1 answer
asked Oct 17, 2019 in Java by Anvi (10.2k points)
0 votes
1 answer
asked Aug 10, 2019 in Java by Suresh (3.4k points)
0 votes
1 answer
asked Oct 28, 2019 in Java by Anvi (10.2k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...