Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; public class JavaCollectionHashCodeExample1 { public static void main(String[] args) { Collection
collection = new HashSet<>(); List
list = new ArrayList
(); collection.add(5); collection.add(3); //returns the hash code int val=collection.hashCode(); System.out.println("Hash Code : "+val); } }
Output