Hi all, I want to know how often do people separate their event listeners to be inner class or public class?
I'm thinking anonymous inner classes would make junior programmers harder to read for clarity sake. If public classes, then most likely I need to pass the necessary variables to the new class. If inner classes, then I need to make the necessary variables as instance variables.
K. Tsang OCPJP7 OCMJEA6
posted 8 years ago
Ordinarily I would use anonymous inner classes for the event listeners. For SCJD I just used seperate classes as this seems so much easier for a junior programmer to understand.
Not sure why your event listeners need to be public though? All mine are private classes in the class where they are used. The variables required by these inner classes are setup as instance variables in the main class for use by the inner classes as you suggested