Import Java.io.BufferedReader;
Import Java.io.BufferedWriter;
Import Java.io.File;
Import Java.io.FileReader;
Import Java.io.OutputStreamWriter;
public class Inverse Value {
/*
*2017-07-01;
*/
public static void Main (string[] args) throws Exception {
TODO auto-generated Method Stub
File File=new file ("Demo\\ Integrated Application \\copy.txt");
BufferedReader br=new BufferedReader (new FileReader (file));
BufferedWriter bw=new BufferedWriter (New OutputStreamWriter (System.out));
String str;
stringbuffer Str =new stringbuffer ("");//create variable string format, can not directly declare, direct declaration will produce null pointer exception;
while ((Str=br.readline ())!=null) {
str.append (STR);//Add the contents of each read to the back of the variable string;
}
str.reverse ();//Drop variable string inverse value;
str=str.tostring ();//Converts a mutable string to a normal string, because write () can only output parameters of type string
Bw.write (str);
Bw.flush ();
Bw.close ();
}
}
Hope to help you with!
All rights reserved, please contact Bo Master!
Java Programming---IO stream reads the contents of the file and outputs its inverse value to the console