Online Java Compiler By
JavaTpoint.com
public class ByteHashCodeMethodExample1 { public static void main(String[] args) { Byte b1 = new Byte((byte) 0.78); //returns the hash code for b1 int val=b1.hashCode(); System.out.println("1. Hash Value = " +val); Byte b2= 12; System.out.println("2. Hash Value = " +b2.hashCode()); //passing negative byte Byte b3 = new Byte((byte) -1); System.out.println("3. Hash Value = " +b3.hashCode()); } }
Output