import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Level;
import java.util.logging.Logger;
public class CharReverse{
public static void main(String args[]) throws FileNotFoundException, IOException{
BufferedReader br=new BufferedReader(new FileReader(“C:\Users\SuNiL\Desktop\HW3Output.txt”));
String str,rev=””;
char st[] = null;
int length=0;
try {
while((str=br.readLine())!=null){
System.out.println(str);
length=str.length();
st=new char[length];
for(int i=length-1;i>=0;i–){
rev=rev+str.charAt(i);
st[length-i-1]=str.charAt(i);
}
rev=rev+”n”;
}
PrintWriter pw=new PrintWriter(new FileWriter(“C:\Users\SuNiL\Desktop\HW3Output.txt”));
pw.print(rev);
pw.flush();
}catch (IOException ex) {
Logger.getLogger(CharReverse.class.getName()).log(Level.SEVERE, null, ex);
}
}
}