wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Abstract/Final  Method-local Inner Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Abstract/Final  Method-local Inner Class " Watch "Abstract/Final  Method-local Inner Class " New topic

Abstract/Final Method-local Inner Class

Marcelo DeOliveira

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

Joined: May 08, 2008
Posts: 27

I changed! My apologies!
Bob Ruth
Ranch Hand

Joined: Jun 04, 2007
Posts: 320
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.


SCJP - 86% - June 11, 2009
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

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

Joined: May 08, 2008
Posts: 27
Thanks guys!
I agree. Here's the link: http://aspose.com/file-tools
subject: Abstract/Final Method-local Inner Class
Similar Threads
local inner classes
query about method local inner classes
inner class instantiation
about inner classes
Class Access Question