Created
January 7, 2015 17:45
-
-
Save washingtonsoares/05e4b56519efd47b4eaf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void salvaContatos(ArrayList<Contato> lista) { | |
| for (Contato c : lista) { | |
| BufferedWriter escritor = null; //objeto escritor | |
| try { | |
| escritor = new BufferedWriter(new FileWriter(new File("contatos"))); | |
| //Instanciação do objeto escritor | |
| escritor.write(c.toString()); //Gravação do texto | |
| escritor.flush(); //descarga do buffer de escrita | |
| escritor.close(); //fechamento do arquivo | |
| } catch (IOException e) { | |
| e.printStackTrace(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment