Por quê esse código não funciona?

1 resposta
Luiz_Claudio3

`package XTI;

import java.io.BufferedWriter;

import java.io.IOException;

import java.nio.charset.Charset;

import java.nio.charset.StandardCharsets;

import java.nio.file.Files;

import java.nio.file.Path;

import java.nio.file.Paths;

public class Arquivo263 {

public static void main(String[] args){

	Path path = Paths.get("C:/Users/LuizClaudio/focus/XTI/files/texto.txt");
	
	Charset utf8 = StandardCharsets.UTF_8;
	
	try(BufferedWriter w = Files.newBufferedWriter(path, utf8)){
	
	w.write("Texto\n");
	w.write("Texto");
	w.flush();
	
	}catch(IOException e){
		e.printStackTrace();
	
}
}

}`

1 Resposta

Sergio_Junior

Brother coloca assim

w.write("Texto \r\n");

Criado 23 de março de 2016
Ultima resposta 23 de mar. de 2016
Respostas 1
Participantes 2