How to write the reverse of any string. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to write the reverse of any string.

suppose the input is "This is a Book" the output will be-"kooB a si sihT"

1st Dec 2017, 4:13 PM
Ashit Pradhan
Ashit Pradhan - avatar
1 Answer
+ 6
String text = new StringBuilder("This is a Book").reverse().toString(); StringBuffer instead StringBuilder also works.
1st Dec 2017, 4:40 PM
andreolixam
andreolixam - avatar