Reverse (Java)

From LiteratePrograms

Jump to: navigation, search

This program is a code dump.
Code dumps are articles with little or no documentation or rearrangement of code. Please help to turn it into a literate program. Also make sure that the source of this code does consent to release it under the MIT or public domain license.


import java.io.*;
class Reverse{
	public static void main(String[]args)throws Exception{
		InputStreamReader s= new InputStreamReader(System.in);
		BufferedReader str= new BufferedReader(s);
		System.out.print("Enter a word:  ");
		String word=str.readLine();
		String wordings=(word);
		{
			String testString=word;
			String revString="";
			int len = testString.length();
			
			for (int i=len-1;i>=0;i--)
			{
				revString+=testString.charAt(i);
			}
			System.out.println(word+"\n"+revString);
		}
		
}
}
//Created by Pinoy programer
Download code
Personal tools