diff --git a/Screenshots/program16.png b/Screenshots/program16.png new file mode 100644 index 0000000..c18472b Binary files /dev/null and b/Screenshots/program16.png differ diff --git a/TestJavaCollection7.java b/TestJavaCollection7.java new file mode 100644 index 0000000..22db1e2 --- /dev/null +++ b/TestJavaCollection7.java @@ -0,0 +1,15 @@ +// 16 write a java program to demonstrate HashSet +import java.util.*; +public class TestJavaCollection7{ + public static void main(String args[]){ + HashSet set = new HashSet(); + set.add("Ravi"); + set.add("Vijay"); + set.add("Ravi"); + set.add("Ajay"); + Iterator itr = set.iterator(); + while(itr.hasNext()){ + System.out.println(itr.next()); + } + } +}