Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.PrintWriter;
import java.io.StringWriter;

public class Main {
    /**
     * Converts an exception to a string.
     * @param exception
     * @return
     */
    public static String getExceptionStackTraceAsString(Exception exception) {
        StringWriter sw = new StringWriter();
        exception.printStackTrace(new PrintWriter(sw));
        return sw.toString();
    }
}