deyanmalinov

3. ALL CAPITALS!

Apr 9th, 2020
241
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.*;
  2. public class Main {
  3.     public static void main(String[] args) throws IOException {
  4.         String path = "D:\\Coding\\BG_Softuni\\Java Advanced - January 2019" +
  5.                 "\\04.1. Java-Advanced-Files-and-Directories-Exercises\\" +
  6.                 "04. Java-Advanced-Files-and-Streams-Exercises-Resources\\input.txt";
  7.         String output = "D:\\Coding\\BG_Softuni\\Java Advanced - January 2019" +
  8.                 "\\04.1. Java-Advanced-Files-and-Directories-Exercises\\" +
  9.                 "04. Java-Advanced-Files-and-Streams-Exercises-Resources\\output.txt";
  10.         BufferedReader reader = new BufferedReader(new FileReader(path));
  11.         PrintWriter writer = new PrintWriter(new FileWriter(output));
  12.         try {
  13.             String line = reader.readLine();
  14.             while (line != null){
  15.                 String uper =line.toUpperCase();
  16.                 System.out.println(uper);
  17.                 line=reader.readLine();
  18.                 writer.write(uper + "\r\n");
  19.             }
  20.         } catch (FileNotFoundException e) {
  21.             e.printStackTrace();
  22.         } catch (IOException e) {
  23.             e.printStackTrace();
  24.         }
  25.         writer.close();
  26.     }
  27. }
RAW Paste Data