How to reverse a string?
Posted
by WM
on Stack Overflow
See other posts from Stack Overflow
or by WM
Published on 2010-05-10T18:18:15Z
Indexed on
2010/05/10
18:24 UTC
Read the original article
Hit count: 276
Example : hi how are you;
output : you are how hi;
but wrote this code and im stuck not knowing how to put a string into an array and reverse it..?
public class Reverse
{
public static void main(String[] args)
{
Scanner text = new Scanner(System.in);
System.out.print("Enter your Text : ");
String input = text.nextLine();
Scanner text2 = new Scanner(text.nextLine());
String[] array = new String[] ;
int i;
for(i = 0; i < input.length(); i++)
{
array[i] = input;
© Stack Overflow or respective owner