program 16

This commit is contained in:
2026-02-12 14:40:32 +05:30
parent 1a6f71bf5b
commit 7aec4f3c6b
2 changed files with 15 additions and 0 deletions

BIN
Screenshots/program16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

15
TestJavaCollection7.java Normal file
View File

@@ -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<String> set = new HashSet<String>();
set.add("Ravi");
set.add("Vijay");
set.add("Ravi");
set.add("Ajay");
Iterator<String> itr = set.iterator();
while(itr.hasNext()){
System.out.println(itr.next());
}
}
}