File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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.


I agree. Here's the link:
subject: inner class
It's not a secret anymore!