Online Java Compiler By
JavaTpoint.com
public class BooleanHashCodeExample1 { public static void main(String[] args) { //create two boolean objects b1 and b2 Boolean b1 = true; Boolean b2 = false; // assign hash code of b1 and b2 int val1 = b1.hashCode(); int val2 = b2.hashCode(); //print the hash code System.out.println("1. Hash code of true = "+val1); System.out.println("2. Hash code of false = "+val2); } }
Output