This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi Roopa, I am not sure what you are having problems with but the first three indexOf method are looking for the empty string character. The indexOf method will never fail to find a match for an empty string. It will always be the first index of any string! The last indexOf method call is looking for a capital J which is found in the first index position. Therefore, the output is four zeroes with a single space between them. Regards, Manfred.