Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Java Set

// A Java program to demonstrate a Set.
// Here, you will see how you can add
// Elements using Set.
 
import java.util.*;
 
public class SetExample {
   
    public static void main(String[] args)
    {
        // Set demonstration using HashSet
        Set<String> Set = new HashSet<String>();
         
        // Adding Elements 
        Set.add("one");
        Set.add("two");
        Set.add("three");
        Set.add("four");
        Set.add("five");
         
        // Set follows unordered way.
        System.out.println(Set);
    }
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Java #Set
ADD COMMENT
Topic
Name
5+7 =