Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.BufferedWriter;
import java.io.File;

import java.io.FileWriter;
import java.io.IOException;

public class Main {
    public static File WriteStringToFile(String str) {
        File tmpFile = null;
        try {
            tmpFile = File.createTempFile("z4-", ".tmp");
            BufferedWriter out = new BufferedWriter(new FileWriter(tmpFile));
            out.write(str);
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return tmpFile;
    }
}