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));
    }/*  w ww  .j av a  2 s . co m*/

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