Training --- IO streams

package Suchas;
 import java.io.*;
public class FileIO
{
    public FileIO(String str)
     {
         File f = new File("data.txt");
         try
         {
             File file = new File("data.txt");
             FileWriter fw = new FileWriter(file);
             BufferedWriter bw = new BufferedWriter(fw);
            bw.write(str);
             bw.close();
         } catch (IOException e)
         {
            e.printStackTrace();
        }
    }
    public static void main(String[] args)
    {
         String str = "12345abcdef@#%&*软件工程";
         new File(str);
 
     }
 
 }

Guess you like

Origin www.cnblogs.com/al1018/p/11028858.html