Sort the items of a Set and display the sorted elements.



package one;
import java.util.*;

public class SetItems {
public static void main(String[] args) {
Set<String> set = new TreeSet<String>();
set.add("Porkodi");
set.add("Anup");
set.add("Malu");
set.add("Mahendran");
set.add("RajKumar");
set.add("Saravana");
set.add("Viniston");

for (String item : set) {
System.out.println(item + " ");
}
}

}

1 comment :

  1. I have read your blog its very attractive and impressive. I like it your blog.

    Java Online Training Java EE Online Training Java EE Online Training Java 8 online training Core Java 8 online training

    Java Online Training from India Java Online Training from India Core Java Training Online Core Java Training Online Java Training InstitutesJava Training Institutes

    ReplyDelete

Copyright © Rough Record. Designed by OddThemes