Let us understand the problem with an example, suppose "Learn Core Java" is the given string then the expected output should be "nraeL eroC avaJ". We just reverse each word and print the string.
Let us implement the logic step by step:
Step 1: Read the string and split the words using white-space as delimiter. This will return a array of Strings
Step 2: Now write a method that reverses the given word and returns it. In our case reverseWord() method.
Step 3: Use StringBuilder to construct a new string using reversed words. Each reversed word will be appended with a white-space to the string builder except last word.
Checkout the below program
Hope you understood the how to solve the above problem. Thanks for reading.
Happy Testing. Happy Learning.
Let us implement the logic step by step:
Step 1: Read the string and split the words using white-space as delimiter. This will return a array of Strings
Step 2: Now write a method that reverses the given word and returns it. In our case reverseWord() method.
Step 3: Use StringBuilder to construct a new string using reversed words. Each reversed word will be appended with a white-space to the string builder except last word.
Checkout the below program
Hope you understood the how to solve the above problem. Thanks for reading.
Happy Testing. Happy Learning.
Excellent post, thanks for this. I gathered lots of information from this and I am happy about it. Do share more updates.thanks for your information really good and very nice web design company in velachery
ReplyDeleteNice post. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated posts…
ReplyDeleteInformatica online Training
Data Science Online Training
frases de buenos dias Very informative information on your site here. I like this post because we can get some useful information from your blog. I expect more post from you
ReplyDelete