Infosys interview question

Java program to reverse string