• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

creating obj for innerclass.....

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SOURCE: www.danchisholm.net


here line-2 is similar to the syntax of creating an object for static inner classes...

why it is allowed here?


[ December 11, 2008: Message edited by: Ganeshkumar cheekati ]
[ December 11, 2008: Message edited by: Ganeshkumar cheekati ]
 
Sheriff
Posts: 9709
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ganesh if you have the other post that you gave, the compiler automatically inserts the this reference when you create an instance of a non-static inner class in a non-static method of the enclosing class. So the code

void m2() {new A.B();}

is equivalent to

void m2() { this.new A.B();}
 
reply
    Bookmark Topic Watch Topic
  • New Topic