Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package org.coffeedriven;
public class EqualsHashCodeExample {
public static void main(String[] args) {
String a = "Aa";
String b = "BB";
System.out.println("Equals: " + a.equals(b));
System.out.println("Hashcode a: " + a.hashCode());
System.out.println("Hashcode b: " + b.hashCode());
// Output:
//Equals: false
//Hashcode a: 2112
//Hashcode b: 2112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment