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 revString=new StringBuffer(word).reverse().toString();
        System.out.println(word);
        System.out.println(revString);
    }
}
Download code
Views