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 String readFile(String filename) {
        StringBuilder buf = new StringBuilder();
        try {
            BufferedReader input = new BufferedReader(new FileReader(filename));
            String line;

            while ((line = input.readLine()) != null) {
                buf.append(line);
                buf.append(System.getProperty("line.separator"));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return buf.toString();
    }
}