If you request a reference to an anonymous class to reference an anonymous class, the instance object java.lang.Classfor your anonymous class is how you can do this.
If you assign an instance of an anonymous class to a variable obj, you can have a reference to class c obj.getClass(). The example uses Object, but any class finaland any interface can be used .
Object obj = new Object() {
};
obj.getClass();
You can do the same without explicitly creating a variable like obj like
Button b = ...;
b.addActionListener(new ActionListener() {
....
});
ActionListener[] listeners = b.getActionListeners();
for (ActionListener listener : listeners) {
System.out.println(listener.getClass());
}
"" ( , ), .