get Current Class Name - Java java.lang

Java examples for java.lang:Exception

Description

get Current Class Name

Demo Code


//package com.java2s;

public class Main {
    public static String getCurrentClassName() {
        StackTraceElement stack[] = (new Throwable()).getStackTrace();
        return stack[1].getClassName();
    }/*from www  .j  ava  2 s  . c o  m*/
}

Related Tutorials