Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.File;

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

public class Main {
    public static boolean writeLineToFile(File file, String line, boolean append) {
        try {
            FileWriter fileWriter = new FileWriter(file, append);
            fileWriter.append(line + "\r\n");
            fileWriter.flush();
            fileWriter.close();
            return true;
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
    }
}