• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Abstract/Final Method-local Inner Class

 
Marcelo DeOliveira
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anybody have any good reason to create a abstract or final Method-local Inner class?
 
Swapnil Sonawane
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please modify your name according to Javaranch naming policy.
 
Marcelo DeOliveira
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swapnil,

I changed! My apologies!
 
Bob Ruth
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Clapham
Sheriff
Posts: 21116
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic