0
I can't understand why we need compared, equal method. What is the important reason to use it to compared variables ...
3 Réponses
+ 3
to see if the two variable are equal, for example password? or when you do a console program that takes user input, and compare the input with the predefined options, then execute the code corresponding to the user input
+ 3
if you are wondering why equal method exist, when == can so the task....
well... == is for reference comparison, equal method is for object comparison
http://stackoverflow.com/questions/7520432/what-is-the-difference-between-vs-equals-in-java
+ 1
Thank you Heng. Yeah.. A password should not be equal to others, and need comparison :0 I will read the page that you uploaded.