-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathAns 1
More file actions
31 lines (28 loc) · 705 Bytes
/
Copy pathAns 1
File metadata and controls
31 lines (28 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java .io.*;
public class Test
{
public static void main(String[] args) throws IOException
{
PrintWriter out=new PrintWriter("two.txt");
PrintWriter pw =new PrintWriter(new FileWriter("one.txt"));
for(int i=100;i<150;i++)
{
pw.println(i);
pw.flush();
}
System.out.println("The number is inputed.");
BufferedReader br=new BufferedReader(new FileReader("one.txt"));
String line= br.readLine();
out.println("reverse");
while(line!=null)
{
String rev=new StringBuilder(line).reverse().toString();
out.println(rev);
out.flush();
line=br.readLine();
}
System.out.println("Reverse is done");
pw.close();
out.close();
}
}