Java tutorial
//package com.java2s; public class Main { public static String getName(Object obj) { String name = obj.getClass().getName(); int dotPos = name.lastIndexOf("."); if (dotPos != -1 && dotPos < name.length() - 1) { return name.substring(dotPos + 1); } else { return name; } } }