Same Accounts problem (Many Ways) done in Java; similar in JJ Function to determine if a given account is the same as another one in both balance and id. (same fields does not mean identical objects!) Recall the definition of Account class: bal is a real; id is a String!! They are compared differently. // a short version: public boolean isSameAs (Account a) { return ( (bal == a.bal) && (id.equals(a.id) ); } // a clear version: public boolean isSameAs (Account a) { if( (this.bal == a.bal) && (this.id.equals(a.id) ) return true; else return false; }//end Function isSameAs2 // a clever version public boolean isSameAs (Account a) { boolean result = false; if ( bal == a.bal) && (id.equals(a.id)) result = true; return result; }//end function isSameAs3 // another version, avoids boolean logic public boolean isSameAs (Account a) { if (bal == a.bal) if (id.equals(a.id) return true; return false; }//end Function isSameAs4 Other solutions proposed: // a non-class version public boolean areSame (Account a, Account b) { if ((a.bal == b.bal) && (a.id.equals(b.id) ) return true; else return false; }// endFunction areSame // a non function (routine) public void outCompare (Account a) { if ( ... ) System.out.println ("same"); elwe System.out.println ("differ"); }//end Routine outCompare