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 getCallPoint(int N) {
        return getClass(N + 1) + "(" + getLine(N + 1) + "):" + getMethod(N + 1);
    }

    public static String getClass(int N) {
        StackTraceElement ste = Thread.currentThread().getStackTrace()[N];
        return ste.getClassName();
    }

    public static int getLine(int N) {
        StackTraceElement ste = Thread.currentThread().getStackTrace()[N];
        return ste.getLineNumber();
    }

    public static String getMethod(int N) {
        StackTraceElement ste = Thread.currentThread().getStackTrace()[N];
        return ste.getMethodName();
    }
}