Java tutorial
//package com.java2s; public class Main { public static String shortClassName(Object obj) { if (obj == null) return "null"; return shortClassName(obj.getClass()); } public static String shortClassName(Class c) { String clss = c.getName(); int inx = clss.lastIndexOf('.'); if (inx >= 0) clss = clss.substring(inx + 1); return clss; } }