I have a class public class N
and an object A a = new B();
The class B looks like this:
public class B extends A { ... }
I want to get a subclass name of the object a inside N as a String (also: "B"). How can i do this?
EDIT: In my case I use Visitor-Pattern. I have public void visit(A a), when a is previously defined as A a = new B(). Then I need to call public void visit(B b). How can I define, that I need to call exactly visit(B b)?