O código compila normalmente, entretanto o arquivo txt não sofre alterações;
package br.com.alura.java.io.teste;
import java.io.FileWriter;
import java.io.IOException;
public class TesteEscrita2 {
public static void main(String[] args) throws IOException {
//Fluxo de Entrada com Arquivo
// OutputStream fos = new FileOutputStream("lorem2.txt");
// Writer osw = new OutputStreamWriter(fos);
// BufferedWriter bw = new BufferedWriter(osw);
FileWriter fw = new FileWriter("lorem2.txt");
fw.write("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod");
fw.write(System.lineSeparator());
fw.write(System.lineSeparator());
fw.write(System.lineSeparator());
fw.write("\r\n");
fw.write("asfasdfsafdas dfs sdf asf assdß");
fw.close();
}
}