+ 1

How to reverse a string using array in java?

9th Jan 2022, 12:22 PM
RealEmmaPlays
RealEmmaPlays - avatar
4 Answers
+ 2
Use Reverse Function of StringBuffer Class: StringBuffer sbf = new StringBuffer("Mostafa!");         System.out.println("String buffer = " + sbf);         sbf.reverse();         System.out.println(sbf)
9th Jan 2022, 12:41 PM
Mostafa
Mostafa - avatar
+ 1
Yes, maybe when u learned java core and basic structures and algorithms. But this is Learning Resource, and it's good to know how things work before u use them. And yes i know they ask you those things at Google interviews for example. Whiteboard all the way. Of course if you are lazy and dont wanna study stuff - your choice. Not saying you have to learn bytecode, but general idea of what's happening in JVM will help.
11th Jan 2022, 2:04 AM
Dennis Torhov
Dennis Torhov - avatar
0
Did u try anything at all? Or u want the whole answer?
9th Jan 2022, 1:44 PM
Dennis Torhov
Dennis Torhov - avatar
0
Because in many companies you will be using/writing their own proprietary libraries, and they want to see that u can write your own solutions.
10th Jan 2022, 3:17 PM
Dennis Torhov
Dennis Torhov - avatar