You can get any object to report the class it was instantiated from
// Object hierarchy
class A{ }
class B extends A { }
class C extends B { }
// Declare 3 variables of type A
A a,b,c;
// Now instantiate an object from each class
a = new A();
b = new B();
c = new C();
// Get each object to report its class name
println(a.getClass().getSimpleName());
println(b.getClass().getSimpleName());
println(c.getClass().getSimpleName());