Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; import java.util.List; public class JavaListHashCodeExample3 { public static void main(String[] args) { List
list = new ArrayList<>(); list.add(null); //returns NullPointerException for null elements. for(String str:list) { System.out.println("Hash Code : " + str.hashCode()); } } }
Output