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  w w .  j  a v  a 2  s  .com*/

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