Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package DPM;
- import java.io.*;
- public class Main {
- public static void main(String[] args) {
- String inputPath = "D:\\Coding\\Java\\Softuni\\Java Advanced - January 2019" +
- "\\04. Java-Advanced-Fiels-and-Directories-Lab\\04. Java-Advanced-" +
- "Files-and-Streams-Lab-Resources\\input.txt";
- String outputPath = "D:\\Coding\\Java\\Softuni\\Java Advanced - January 2019" +
- "\\04. Java-Advanced-Fiels-and-Directories-Lab\\04. Java-Advanced-" +
- "Files-and-Streams-Lab-Resources\\output.txt";
- try (BufferedReader reader = new BufferedReader(new FileReader(inputPath));
- PrintWriter writer = new PrintWriter(new FileWriter(outputPath))){
- int coutner = 1;
- String line = null;
- line = reader.readLine();
- while (line != null){
- if (coutner % 3 ==0){
- writer.println(line);
- }
- coutner++;
- line=reader.readLine();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement