The set is an Interface, so we can't make an object. You need to import TreeSet or SortedSet class and thus follow the steps.
import java.util.Set;
import java.util.TreeSet;
public class setExample {
public static void main(String args[])
{
Set s=new TreeSet();
s.add(10);
s.add(10);
s.add(20);
System.out.println(s);
}
}
output:
Set does not contains any duplicates value.