Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.io.PrintWriter;
- import java.util.Scanner;
- public class input {
- public static void main(String[]args) throws FileNotFoundException,IOException{
- //prompt for input
- String inputFileName = args[0];
- String outputFileName = args[1];
- // construct scanner and printwriter for reading and writing
- File inputFile = new File(inputFileName);
- Scanner filescn = new Scanner(inputFile);
- PrintWriter out = new PrintWriter(outputFileName);
- int lineNumber = 1;
- while (filescn.hasNextLine())
- {
- String line = filescn.nextLine();
- StringBuffer revLine = new StringBuffer(line).reverse();
- out.println(revLine);
- lineNumber++;
- }
- filescn.close();
- out.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement