Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.io.*;
- public class FileIO{
- public static void main (String args [])throws IOException{
- String input = JOptionPane.showInputDialog("Enter FileName: ");
- File x = new File(input);
- File f = new File ("d:\aa\bb\");
- f.mkdirs();
- FileWriter text = new FileWriter (f + "\grades.txt");
- text.write("90");
- text.write("91");
- text.write("92");
- text.write("93");
- text.write("94");
- text.close();
- if (f.exists()){
- System.out.println(f.getPath() + " exist");
- } else {
- System.out.println(f.getPath() + " does not exist");
- }
- /* int sum = 0, ctr=0;
- while(val != null){
- ctr++;
- sum += Integer.parseInt(val);
- val = x.readLine();
- }
- System.out.println("Ave = " + sum/ctr);
- f.close();*/
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement