• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

object of inner class - where can't we make

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At what place we can't make an object of regular inner class ???

thanks .
[ January 11, 2005: Message edited by: rathi ji ]
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nowhere, with a bit of trickery you can instantiate them whereever you want to.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was also thinking the same .

1] inside outer class , inside a instance code :
MyInner m = new MyInner();

2] inside outer class , inside static code :
MyOuter.MyInner m = new MyOuter.new MyInner();

3] outside outer class ,inside any method static or instance :
MyOuter.MyInner m = new MyOuter.new MyInner(); // MyOuter shuld be visible
[ January 13, 2005: Message edited by: rathi ji ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic