@Anonymous, It actually does print 'a' twice for 'Java', its just that I missed when I copied output from Eclipse. You can try running program in your machine, it will print.
List of duplicate characters in String 'Java'
a : 2
Jul 24, 2015, 6:59:14 PM
Posted to How to Find Duplicate Characters in String [Java Coding Problems]