import java.io.*;
public class NewClass {
public static void main(String[] args) {
String Frase = null;
File arq = new File("C:\\Teste1", "Saida.txt");
//Inicia leitura do arquivo
try {
FileReader fileReader = new FileReader("C://Teste1/User2.txt");
BufferedReader bufferedReader = new BufferedReader(fileReader);
Frase = bufferedReader.readLine();
fileReader.close();
bufferedReader.close();
} catch (IOException e) {
System.out.println("erro");
}
System.out.println(Frase);
//Inicia gravação do arquivo de saída
try {
arq.createNewFile();
FileWriter fileWriter = new FileWriter(arq, false);
PrintWriter printWriter = new PrintWriter(fileWriter);
printWriter.print(Frase);
printWriter.flush();
printWriter.close();
} catch (IOException e) {
System.out.println("erro");
}
}
}
Nenhum comentário :
Postar um comentário