Friday, 6 May 2016

HashSet in java util package

	import java.util.*;
	class HashSetDemo
	{
		public static void main(String args[])
		{
			// Create a hash set.
			HashSet hs = new HashSet();
			// Add elements to the hash set.
			hs.add("B");
			hs.add("A");
			hs.add("D");
			hs.add("E");
			hs.add("C");
			hs.add("F");
			System.out.println(hs);
		}
	}

No comments:

Post a Comment