Posted By

mouseroot on 11/08/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

nicc777


Read and Write to Files


 / Published in: Java
 

Read and write to files in java

  1. import java.io.*;
  2. import java.util.*;
  3.  
  4. class ...
  5.  
  6. public static void main(String args[]) ...
  7.  
  8. try {
  9.  
  10. //Read
  11. Scanner FileI = new Scanner(new FileInputStream("C://path//to//file.ext"));
  12.  
  13. //Write
  14. Writer FileO = new OutputStreamWriter(new FileOutputStream("C://path//to.ext"));
  15.  
  16. //Read a line
  17.  
  18. FileI.nextLine();
  19.  
  20. //Write a line
  21.  
  22. FileO.write("");
  23.  
  24. } catch(IOException ee) {
  25. System.out.println("There was an error " + ee);
  26. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: Cosheen on May 31, 2019

Take a look here https://domyhomework.guru/blog/process-essay to improve your writing skill. This is a necessary for every student like you!

Posted By: IdaWallace on October 10, 2019

This is definitely helpful programing code for students and I would like to share it with my university students who are taking assignment writing service at nominal rate. Ida Wallace, http://www.assignmenthelpfolks.com/statistics/

Posted By: IdaWallace on October 10, 2019

This is definitely helpful programing code for students and I would like to share it with my university students who are taking assignment writing service at nominal rate. Ida Wallace, http://www.assignmenthelpfolks.com/statistics/

Posted By: IdaWallace on October 10, 2019

This is definitely helpful programing code for students and I would like to share it with my university students who are taking assignment writing service at nominal rate. IdaW,
http://www.assignmenthelpfolks.com/statistics/

Posted By: IdaWallace on October 10, 2019

This is definitely helpful programing code for students and I would like to share it with my university students who are taking assignment writing service at nominal rate. IdaW,
http://www.assignmenthelpfolks.com/statistics/

You need to login to post a comment.