dear programmers,
i need help with one of my java program. the program should ask the user to enter a sentence and the then return the number of repeated characters in a row. as a example if the user enter "myy naame is joshh"the user should return "3 repeated characters" i dont need the whole program but help me with how i can count repeated number of characters in a row. Thank you

Recommended Answers

All 4 Replies

Check out the string class dude...character parsing and such

I dont know which one to use.I am completely new in java programming. Just give me a hint which code to use to find repeating char in a row in the string.

Well I am new here too learning Java from PJ Deitel's book but the problem is I am not clear about all the things in the book what should I do now learning from books seems boring to me !!!

you just compare charx to chary. if they're equals => add 1 to number of repeating characters.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.