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

NoobtoDev

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

Dont have an account, 

NoobtoDev

Learn from the best resources available, Sign up :)

Do you have an account, 

NoobtoDev

Forgot Password

Dont worry!

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

Back to  

   Welcome to NoobtoDev, Keep exploring and learning.

Your request has been submitted successfully

You've voted successfully

You've already voted!

How do I compare strings in Java ?

- 05 July,20
9 Views
Answers

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

Answers

+1

0

"==" 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