Hi all I have a method that creates a JFrame, within this is a button that has an anonymous inner class that disposes of the frame. The JFrame has to be final so it can be referenced in the anonymous inner class, what are the consequences of having a JFrame final? I suspect not much as it only makes the reference to the JFrame constant. Is this correct? Thanks
Making the JFrame in the top-level final puts the JFame in-line with the compiled class, where any inner class is guaranteed it can complete a reference. An anonymous inner class would not be able to refer to an element outside its top-level class, so insisting on the final scope avoids trouble.
Make visible what, without you, might perhaps never have been seen. - Robert Bresson