• 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

Inner classes

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why inner classes cannot contain non-final static variables or static methods, but may them inherit.
What is the sense?
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How is Debbie Harry these days? Still in love with you?

Sun says: -

Because an inner class is associated with an instance, it cannot define any static members itself.



I think that they could easily have allowed static members in inner classes, but they thought it would encourage poor programs, so forbade it. That may or may not have been a good decision, but we don't gain a huge amount by worrying about it!
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Denis Denis"

Welcome to Javaranch!

Please could you update your display name to comply with out Naming Policy. You can do this here.

Thanks!

(Also, this is not an advanced question, so I will more it somewhere more appropriate)
reply
    Bookmark Topic Watch Topic
  • New Topic