Here you can find the source of classname(Object obj)
public static String classname(Object obj)
//package com.java2s; //License from project: Open Source License public class Main { public static String classname(Object obj) { if (obj != null && obj.getClass().getEnclosingClass() == null) { return obj.getClass().getSimpleName(); } else {/*from w w w . j a v a 2 s .c o m*/ return null; } } }