Wash your hands, Be inside, Be safe and keep learning. #happyquarantine #happylearning
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?
+1
"==" 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.
Do comment here
Welcome to NoobtoDev, Keep exploring and learning.
Your request has been submitted successfully
You've voted successfully
You've already voted!
Do comment here