Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        // create set
        Set<String> set = new HashSet<String>();

        // populate the set
        set.add("A");
        set.add("B");
        set.add("from");
        set.add("java2s.com");

        // create a synchronized set
        Set<String> synset = Collections.synchronizedSet(set);

        System.out.println("Synchronized set is :" + synset);
    }
}