Wash your hands, Be inside, Be safe and keep learning. #happyquarantine #happylearning

How do I compare strings in Java ?

- 05 July,20

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.

Is == bad? When should it and should it not be used? What's the difference?

Do comment here




"==" Checks whether  both object points to a same location or not. It doesn't check what values it holds.

". equals()" checks whether the values in both the objects are equal or not.

- Answered 11 July,20
    Answered by @jagmohan

Do comment here

Write your answer


Learn from the best resources available, Sign in :)
Enter valid credentials!

Dont have an account, 


Learn from the best resources available, Sign up :)

Do you have an account, 


Forgot Password

Dont worry!

Enter your email and we'll send you an email with instruction to change the password.

Back to  


Add your website or blog here

Fill up required fields carefully

   Welcome to NoobtoDev, Keep exploring and learning.

Your request has been submitted successfully

You've voted successfully

You've already voted!