Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.*;

public class Main {
    public static void WriteFile(String file, String message) throws IOException {
        File f = new File(file);
        if (!f.exists()) {
            f.createNewFile();
        }
        FileOutputStream fout = new FileOutputStream(file);
        byte[] bytes = message.getBytes();
        fout.write(bytes);
        fout.close();
    }
}