
accept a string and print reverse without using api

hi friend try the code given below this may helpful for you
public class ReverseString
{
public static void main(String args[])
{
String str = "hello";
int len = str.length();
char tempArr[]=new char[len ];
char revArr[]=new char[len ];
tempArr = str.toCharArray();
int k = 0;
for(int i=len-1; i >=0; i--)
{
revArr[k] = tempArr[i];
k++;
}
System.out.println("Original String = "+str);
System.out.print("Reverse String = ");
for(int j = 0; j < len; j++)
{
System.out.print(revArr[j]);
}
}
}