This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread 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
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 3829
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: 3829
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 ]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: object of inner class - where can't we make
 
Similar Threads
Protected Class?
can a sub class reference access private variable of super class?
how to subclass a inner class ?
inner classes
inheritance n inner classes