Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {
    public static boolean writeString(String filePath, String content) {
        File file = new File(filePath);
        if (!file.getParentFile().exists())
            file.getParentFile().mkdirs();

        FileWriter writer = null;
        try {

            writer = new FileWriter(file);
            writer.write(content);

        } catch (IOException e) {
        } finally {
            try {
                if (writer != null) {

                    writer.close();
                    return true;
                }
            } catch (IOException e) {
            }
        }
        return false;
    }
}