• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jane Griscti's tutorial

 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question is mainly addressed to Jane Griscti but anyone who has any idea about the answer is free (and encouraged) to give it
In the tutorial "SCJP2 Study Notes", in section "Overloading, Overriding, Runtime Types and Object Orientation - Static Nested Classes" it is stated, I quote:


- they are not associated with an instance of their outer class ie you can create an Inner class object from within the Outer class using new Inner(); you do not need to create an Outer class object first as is required with non-static inner classes
- you cannot create instances of a static inner class


So to summarize, the first statement says that we may create an Inner class object and the second statement says that we cannot create instances of static inner classes. It is worth noting that both statements concern static inner classes, a.k.a. top-level nested classes.
Anyone any insight ?
Thank you very much
Val
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone,
I would be really grateful if you could answer the question.
Thank you very very much
Val
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Anyone any insight ?


Yup ... I'm not the greatest note taker The pages aren't meant to be a 'tutorial' ... just the notes I made during my orignal studies.
You can create 'instances' of a static nested class. See the following example:

Thanks for pointing out the mistake on my pages.
Also, I should have listed that 'static inner classes can directly access static fields in the outer class but require an instance of the outer class to access the outer class instance fields'


------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Jane
it helped a lot...
Val
 
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where I can find these study notes?
 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here - http://www.janeg.ca/
HTH,
- Manish
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic