Advertisement
Didart

ALL CAPITALS!

Jan 26th, 2023 (edited)
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. package StreamsFilesAndDirectories4;
  2.  
  3. import java.io.*;
  4. import java.nio.file.Files;
  5. import java.nio.file.Path;
  6. import java.util.List;
  7.  
  8. public class AllCAPITALS {
  9.     public static void main(String[] args) throws IOException {
  10.  
  11.         String path = "C:\\Users\\User\\Desktop\\Java Advanced - 10.01.23 - 13.09.22\\src\\StreamsFilesAndDirectories4\\04. Java-Advanced-Files-and-Streams-Exercises-Resources\\input.txt";
  12.         BufferedWriter bw = new BufferedWriter(new FileWriter("output.txt"));
  13.  
  14.         List<String> allLines = Files.readAllLines(Path.of(path));
  15.         for (String line : allLines) {
  16.             bw.write(line.toUpperCase());
  17.             bw.newLine();
  18.         }
  19.         bw.close();
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement