0
My idea is to create a small database . txt to save a user’s data.
public void menuContato(){
try{
FileWriter fw = new FileWriter("usuarios.txt");
PrintWriter pw = new PrintWriter(fw);
System.out.println("CRIAÇÃO DE CONTATO");
System.out.println("Nome: ");
this.nome = leitor.nextLine();
pw.print(this.nome);
System.out.println("Email: ");
this.email = leitor.nextLine();
pw.print(this.email);
System.out.println("Telefone: ");
this.telefone = leitor.nextLine();
pw.print(this.telefone);
Contato usuario = new Contato(nome, email,telefone);
dados.registraContato(usuario);
}
catch(IOException e){
out.println("ERRO");}
}
The problem is when I’m gonna use the Pw.print() and put the variable, the file users.txt is created, but nothing is written in the file.
What can I do?