Advertisement
Guest User

Untitled

a guest
May 28th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1.  
  2. package javaapplication1;
  3. import java.io.*;
  4. public class Main {
  5. public static void main(String[] args) {
  6. try{
  7. FileWriter carFile = new FileWriter("Cars.txt",true);
  8. PrintWriter carWriter = new PrintWriter(carFile);
  9. carWriter.println("Audi Q7");
  10. carWriter.close();
  11. FileReader carFILE = new FileReader("Cars.txt");
  12. BufferedReader carStream = new BufferedReader(carFILE);
  13. String car = carStream.readLine();
  14. System.out.println(car);
  15.  
  16. }
  17. catch(IOException e)
  18. {
  19. System.out.println("There was a problem writing to file.");
  20. }
  21. //catch(FileNotFoundException e)
  22. }
  23.  
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement