Java tutorial
//package com.java2s; public class Main { /** * * @return */ public static String getCallerMethodName() { return Thread.currentThread().getStackTrace()[2].getMethodName(); } public static String getMethodName() { return Thread.currentThread().getStackTrace()[1].getMethodName(); } }