Hi,

This is ravi i have a question like this i have string
"UNDERSTAND" now i want to count the letters how many times
it occures.i.e from the above string the out put should be
like this U-1,N-2,D-2,E-1,R-1,S-1,T-1,A-1.
how can i achieve this

Thnaks in advance for your response ..

Answer Posted / dilip

Actually what i think is take integers from a-z and
initialize each with 0



then take the string & using charAt & equalsIgnoreCase
increment the respaective values & then print the same.....

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where is the find and replace?

535


If a method is declared as protected, where may the method be accessed?

535


Explain wait(), notify() and notifyall() methods of object class ?

600


What if static is removed from main method?

575


Write a java program to count the number of words present in a string?

538






Explain the difference between intermediate and terminal operations in java8?

569


What does flag mean in java?

544


What is intern method in java?

585


What is the order of arraylist in java?

611


What is null object in java?

572


How are this() and super() used with constructors in java programming?

573


When do you get classcastexception?

558


What is the difference between a break statement and a continue statement?

601


Explain the difference between protected and default access.

518


What do you mean by boolean?

580