A Java code which returns a string after reversing only the alphabets in a sentence which is passed as an argument the method. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

A Java code which returns a string after reversing only the alphabets in a sentence which is passed as an argument the method.

Note: 1. reversing has to be done word-by-word. 2. Any inbuilt method except {length(), charAt(), indexOf(), compareTo(), equals()} should not be used. 3. Do not use hashmap. Input String : It Costs 25000rs for 1 LCD Projector. Output: tI stsoC 25000sr rof 1 DCL rotcejorP.

29th Jul 2020, 12:38 AM
Prashant Pal
Prashant Pal - avatar
7 Answers
+ 2
I thought to solve it using stack.. rather than using an extra array and splitting string into array of words and reversing each word. But I'm stucked with my logic.
29th Jul 2020, 2:23 AM
Prashant Pal
Prashant Pal - avatar
+ 1
Is this your assignment? if so then, it would be required of you to try it on your own first. If you run into difficulties though, you may save the code in SoloLearn, and share the saved code link within your thread Description (above) in order for others to analyse it, and assist you through. Follow the below guide to sharing links in this forum 👍 https://www.sololearn.com/post/75089/?ref=app
29th Jul 2020, 1:58 AM
Ipang
+ 1
I did it using charAt().
29th Jul 2020, 8:44 AM
Prashant Pal
Prashant Pal - avatar
+ 1
Prashant Pal Is it solved? Mark your question [SOLVED] if so ...
29th Jul 2020, 8:47 AM
Ipang
+ 1
[SOLVED]
29th Jul 2020, 11:34 AM
Prashant Pal
Prashant Pal - avatar
0
Is it possible to do it without using charAt()?
29th Jul 2020, 4:17 AM
Roopesh
Roopesh - avatar
0
Prashant Pal I can't find a Java code in your profile codes section. Did you save the code here or not? If it's ok maybe you can share the code for someone who may need it as reference in the future.
5th Aug 2020, 4:21 PM
Ipang