-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathL4L3.java
More file actions
34 lines (25 loc) · 877 Bytes
/
L4L3.java
File metadata and controls
34 lines (25 loc) · 877 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
32
33
34
//Ranye Mclendon
//EEGR 409
//Lecture 4 Lab 3
//02/24/2022
//This is a program reads 10 numbers,stores them in an array, and prints the reverse
import java.io.*;
import java.util.Scanner;
public class L4L3 {
public static void main (String[] args) throws IOException{
//open and reads file
File myFile = new File("lab4_3.txt");
Scanner in = new Scanner(myFile);
//open output file
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("copy_of_lab4_3.txt")));
//read line by line
System.out.print("Copying the file...");
while (in.hasNextLine()){
String buffer = in.nextLine();
out.println(buffer);
}
System.out.print("File copied");
in.close();
out.close();
}
}