So I understand that the compiler takes *.java files, processes them and spits out *.class files.
But, when there's more than one class in a file, what's the deal with making multiple *.class files with a "$1" in the middle?
Does this mean I should be using more than one *.java file? Is the compiler (only slightly joking here) mad at me and fixing my mistakes??
This situation is for class files for button listeners -- the classes are inside the GUI java file. I wanna do the right thing and not learn things by doing it wrong.
/Janeice/
When you do things right, people won't be sure you've done anything at all.
Inner classes are quite often very useful. Anonymous inner classes are great for when you need a class only at one specific point in your code. Event listeners are quite often programmed as anonymous inner classes.
The only problem about anonymous inner classes is that bit Rob mentioned about "one specific point". It can be difficult to be sure you won't need something similar elsewhere. If I am sure there is only one place I shall use it, I am happy to use an anonymous inner class.