Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public void creaFile() {
  2. try {
  3. file = new FileOutputStream ("prova.txt");
  4. } catch (FileNotFoundException e) {
  5. System.out.println("Errore nella creazione del file");
  6. }
  7.  
  8. try {
  9. fw = new FileWriter("prova.txt");
  10. } catch (IOException e) {
  11. // TODO Auto-generated catch block
  12. e.printStackTrace();
  13. }
  14.  
  15. bf = new BufferedWriter(fw);
  16.  
  17. }
  18.  
  19. public void scriviSuFile(Dipendente d) {
  20. try {
  21. bf.write(d.getId());
  22. bf.flush();
  23. } catch (IOException e) {
  24. System.out.println("Errore nella scrittura");
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement