My Blog
Articles related to programming, computer science, technology and research.

14/05/2018 Categories: Strings. 1 Comment on Java program to ignore duplicates in a string and print each character only once in ascending order

This is a Java program that accepts a string from the user, ignores any duplicate characters and prints each character only once in ascending order.   We use TreeSet class from collections framework for printing the characters in ascending order.   The program is as follows:   import java.util.*; public class Sample { public static […]

This is a Java program that accepts a string from the user, ignores any duplicate characters and prints each character only once in ascending order.

 

We use TreeSet class from collections framework for printing the characters in ascending order.

 

The program is as follows:

 

 

If you want to display in insertion order, you can use LinkedHashSet.

Related Links:

1 Comment

You can follow any responses to this entry through the RSS 2.0 feed.

Hurrah, that’s what I was looking for, what a stuff!
existing here at this weblog, thanks admin of this site.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll Up