Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.io.*;
  3. public class FileIO{
  4. public static void main (String args [])throws IOException{
  5.  
  6. String input = JOptionPane.showInputDialog("Enter FileName: ");
  7. File x = new File(input);
  8.  
  9. File f = new File ("d:\aa\bb\");
  10. f.mkdirs();
  11.  
  12.  
  13. FileWriter text = new FileWriter (f + "\grades.txt");
  14. text.write("90");
  15. text.write("91");
  16. text.write("92");
  17. text.write("93");
  18. text.write("94");
  19.  
  20. text.close();
  21.  
  22. if (f.exists()){
  23. System.out.println(f.getPath() + " exist");
  24. } else {
  25. System.out.println(f.getPath() + " does not exist");
  26. }
  27.  
  28.  
  29.  
  30.  
  31. /* int sum = 0, ctr=0;
  32.  
  33. while(val != null){
  34. ctr++;
  35. sum += Integer.parseInt(val);
  36. val = x.readLine();
  37. }
  38. System.out.println("Ave = " + sum/ctr);
  39.  
  40. f.close();*/
  41.  
  42.  
  43.  
  44.  
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement