• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is use of Local inner classes?

 
Minal Silimkar-Urankar
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inner classes in code blocks, such as method body, constructor or initialization block is known as Local Inner Classes.

As local inner classes are completely inaccessible outside the method.

If you are defining any local variable you can not access those variables outside the method.

Then what is the use of Local Inner classes?
 
Campbell Ritchie
Sheriff
Pie
Posts: 49826
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most commonly to start a Runnable, or a Listener in Swing. Have a look at this old thread.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know what anonymous inner classes are good for?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic