This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes Inner classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Inner classes" Watch "Inner classes" New topic
Author

Inner classes

Denis Denis
Greenhorn

Joined: Apr 03, 2007
Posts: 5
Why inner classes cannot contain non-final static variables or static methods, but may them inherit.
What is the sense?
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
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!


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

"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)


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
GeeCON Prague 2014
 
subject: Inner classes