Skip to content

Instantly share code, notes, and snippets.

@kubawieczorek
Last active December 15, 2019 11:29
Show Gist options
  • Save kubawieczorek/35d324497b77d263648e02a8ae9477aa to your computer and use it in GitHub Desktop.
Save kubawieczorek/35d324497b77d263648e02a8ae9477aa to your computer and use it in GitHub Desktop.
public static void main(String[] args) {
Car fiat1 = new Car("Fiat", new BigDecimal(4000));
Car fiat2 = new Car("Fiat", new BigDecimal(4000));
System.out.println(fiat2.hashCode() == fiat1.hashCode()); //false
System.out.println(fiat2.equals(fiat1)); //true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment