import java.util.HashSet;
import java.util.Set;
public class CreateHashset {
public static void main(String[] args) {
Set<String> hs = new HashSet<String>();
hs.add("java");
hs.add("php");
hs.add("html");
hs.add("javascript");
hs.add("vb");
//print hashset
System.out.println("hashset = "+hs);
}
}
Output:
hashset = [javascript, php, html, java, vb]
import java.util.Set;
public class CreateHashset {
public static void main(String[] args) {
Set<String> hs = new HashSet<String>();
hs.add("java");
hs.add("php");
hs.add("html");
hs.add("javascript");
hs.add("vb");
//print hashset
System.out.println("hashset = "+hs);
}
}
Output:
hashset = [javascript, php, html, java, vb]
No comments:
Post a Comment