| Author |
Abstract/Final Method-local Inner Class
|
Marcelo DeOliveira
Greenhorn
Joined: May 08, 2008
Posts: 27
|
|
|
Does anybody have any good reason to create a abstract or final Method-local Inner class?
|
a SCJP, almost a SCWCD
|
 |
Swapnil Sonawane
Ranch Hand
Joined: Jan 02, 2008
Posts: 190
|
|
|
Please modify your name according to Javaranch naming policy.
|
Swapnil S. Sonawane<br /> <br />B.Tech (Expected May 2009)<br />Computer Science, NIT Durgapur, India<br />SCJA 1.0
|
 |
Marcelo DeOliveira
Greenhorn
Joined: May 08, 2008
Posts: 27
|
|
Swapnil, I changed! My apologies!
|
 |
Bob Ruth
Ranch Hand
Joined: Jun 04, 2007
Posts: 318
|
|
Marcelo, I am not trying to be trivial in answering your question.... it is just the only thing that comes to mind. Using inner classes within a method like that one can establish a hierarchy of inner classes. I would suppose that an abstract inner class could be inherited by a subsequent inner class. and a final inner class could be instantiated and used further on down in the method. I am sorry that I can not point to an example but this seems as though it would be a reasonable thing to do. Bob
|
------------------------
Bob
SCJP - 86% - June 11, 2009
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
There is no reason why a method-local inner class should not be final. One might consider declaring such a class final to be pointless, but some people like to follow the rule where a class is to be declared final unless it's specifically designed to be subclassed. In this case the rule would usually require a method-local inner class to be declared final.
|
 |
Marcelo DeOliveira
Greenhorn
Joined: May 08, 2008
Posts: 27
|
|
|
Thanks guys!
|
 |
 |
|
|
subject: Abstract/Final Method-local Inner Class
|
|
|