Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String getExceptionStackTrace(Throwable throwable) {
        if (null == throwable) {
            return "null";
        }
        StringBuilder sb = new StringBuilder(throwable.getMessage()).append("\n");
        StackTraceElement[] elements = throwable.getStackTrace();
        for (StackTraceElement element : elements) {
            sb.append(element.toString()).append("\r\n");
        }
        return sb.toString();
    }
}