Articles → Java → Set in Java

Set in Java






What is set in Java?





Example


import java.lang.Math; // headers MUST be above the first class
import java.util.*;

// one class needs to have a main() method
public class HelloWorld
{
  // arguments are passed using the text field below this editor
  public static void main(String[] args)
  {
    	Set<String> set = new HashSet<String>();
		set.add("Test1");
		set.add("Test2");
		set.add("Test1");
        System.out.println(set);
  }
}





Click to Enlarge




Posted By  -  Karan Gupta
 
Posted On  -  Monday, January 30, 2017

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250