Answers for "hashset size in java"

1

HashSet size() method in java

import java.util.HashSet;
public class HashSetSizeMethodExample
{
   public static void main(String[] args)
   {
      HashSet<String> hs = new HashSet<String>();
      hs.add("Welcome");
      hs.add("hello");
      hs.add("world");
      hs.add("core");
      hs.add("java");
      System.out.println("HashSet values: " + hs);
      System.out.println("The size of HashSet is: " + hs.size());
   }
}
Posted by: Guest on October-28-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language