Q:

Java Program to get the number of elements in a hash set

0

Program to get the number of elements in a hash set.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.util.*;
public class demo1 
{
 public static void main(String[] args)
 {
   HashSet<String> hash_set = new HashSet<String>();
   hash_set.add("C#");
   hash_set.add("C++");
   hash_set.add("Java");
   hash_set.add("Python");
   hash_set.add("Perl");
   hash_set.add("Ruby");
   System.out.println("Original Hash Set: " + hash_set);
   System.out.println("Size of the Hash Set: " + hash_set.size());
   }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now