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