Java - Write code to get Short Java Name from Class<?>

Requirements

Write code to get Short Java Name from Class<?>

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        Class c = String.class;
        System.out.println(getShortJavaName(c));
    }//from w  w w  . ja va 2  s  .co  m

    public static String getShortJavaName(Class<?> c) {
        String[] split = c.getName().split("\\.");
        return split[split.length - 1];
    }
}