What is the different between equal and == in JAVA
Anónimo
.equals() is a method that everything that inherits from Object has, if it is not overriden it tests for reference equality (which is what == is). the benefit is you can override .equals() to test for value equality :). == should be used for primitives. .equals() should be used for objects (unless you want to test for reference equality).