DEV Community

Cover image for reverse string in java
realNameHidden
realNameHidden

Posted on

reverse string in java


import java.util.*;
import java.lang.*;
class Demo{
    public static void main(String[] args){
        String s = "brock";
        StringBuilder sb = new StringBuilder(s);
        sb.reverse();
        System.out.println(sb.toString());
    }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)