This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inner class

 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
Hi!
How I can create an object of static inner class if is within a another static inner class?
Thanks in advance.
 
April.Johnson
Ranch Hand
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the following code to see if it answers your question.

April
 
Seema Poddar
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,
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.

------------------
Regards
Seema
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic