Java - Write code to get object Type name

Requirements

Write code to get object Type name

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        Object o = "book2s.com";
        System.out.println(getTypeAsString(o));
    }/*from   w  w w . ja va  2s .  co m*/

    public static String getTypeAsString(Object o) {
        if (o == null)
            return "<null>";
        else
            return o.getClass().getSimpleName();
    }
}