This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes object of inner class - where can't we make Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "object of inner class - where can Watch "object of inner class - where can New topic
Author

object of inner class - where can't we make

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
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

Joined: Oct 12, 2000
Posts: 5093
nowhere, with a bit of trickery you can instantiate them whereever you want to.


42
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: object of inner class - where can't we make