Don't understand why it doesn't work
package com.codegym.task.task13.task1319;
import java.io.*;
/*
Writing to a file from the console
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String fileName = r.readLine();
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("d:/output.txt")));
while(true){
String s = r.readLine();
if (! s.isEmpty())
out.println(s);
if (s.equals("exit"))
break;
}
r.close();
out.close();
}
}