
write a program to accept the string and store the reverse stream into another array and print it.

Hi Friend,
Try the following code:
import java.util.*;
class StringReverse{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.println("Enter string: ");
String st=input.nextLine();
String str[]=st.split("");
String array[]=new String[str.length];
for(int i=str.length-1;i>=0;i--){
array[i]=str[i];
System.out.print(array[i]);
}
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.