The "normal" way to compare two objects in java is to either:
1. override the .equals() method, in your Account class, that is inherited from the Object class
2. Implement the Comparable Interface...
Type: Posts; User: aussiemcgr
The "normal" way to compare two objects in java is to either:
1. override the .equals() method, in your Account class, that is inherited from the Object class
2. Implement the Comparable Interface...
Your problem is with comparing Strings:
if(account == "joe")
String are objects, therefore when you are comparing for equivalency, you need to use the .equals() method instead of ==...