09 April 2012

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 comments:

Naviya Nair said...

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

Post a Comment

Related Posts with Thumbnails

Popular Posts

 
;