This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "inner class" Watch "inner class" New topic

inner class

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
How I can create an object of static inner class if is within a another static inner class?
Thanks in advance.
Ranch Hand

Joined: May 02, 2001
Posts: 48
Check out the following code to see if it answers your question.

Seema Poddar

Joined: Aug 08, 2001
Posts: 2

I just wanted to bring forward this Golden Rule :-
For an Inner class, the Outer class just
acts like a package and thats why, one needs to
follow Fully Qualified Naming Convention, just as we
use for naming Packages or Importing classes.
Consider this example :-
class Outer
static class Inner
static class InnerMost
int x = 5;
public static void main(String args[])
Outer.Inner.InnerMost myInn = new Outer.Inner.InnerMost();
System.out.println("x = " + myInn.x);

Notice how the InnerMost class has been instantiated. The compiler will not resolve the symbol "class InnerMost" until, it gets the Fully Qualified Name, where it is located.


Don't get me started about those stupid light bulbs.
subject: inner class
It's not a secret anymore!