Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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;
        }
    }
}