write text to file

0

I'm using this code to write to the file:

try(BufferedWriter bw = Files.newBufferedWriter(caminho, formato)){

            bw.write("frase teste\n");
            bw.write("outra coisa");

        }catch(IOException e) {
            e.printStackTrace();
        }

But it does not recognize the character. How do I solve it?

    
asked by anonymous 06.01.2017 / 01:07

1 answer

0

Try this:

 try(BufferedWriter bw = Files.newBufferedWriter(caminho, formato)){

    bw.write("frase teste");
    bw.newLine();
    bw.write("outra coisa");

 }catch(IOException e) {
    e.printStackTrace();
 }

link

    
06.01.2017 / 01:12