String reverse in java programming

import java.util.Scanner;

public class StringRevers {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner scc=new Scanner(System.in);
        int n;
        n=scc.nextInt();
        for (int i = 0; i < n; i++) {
            scc.nextLine();
        StringBuffer aBuffer=new StringBuffer(scc.nextLine());
        System.out.println(aBuffer.reverse());
        }
      
      
    }

}

Share this

Related Posts

Previous
Next Post »