• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Method Local inner class

 
Himalay Majumdar
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the code below, if I comment Lines 13, 16 I am able to print the final String "Show" in Line 11.
Is there any way I can access and print all the Strings inside the shows method.



OUTPUT

MyOuter
Inner
Inner
 
Ruben Soto
Ranch Hand
Posts: 1032
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you can do that because the x inside the method local inner class will shadow the local variable x inside the method.
 
Ankit Garg
Sheriff
Posts: 9529
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ruben is right. There is no way of doing that
 
Himalay Majumdar
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats wat I thought..thanks guys
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic