GeeCON Prague 2014*
The moose likes Java in General and the fly likes y static var r not allowed in 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 "y static var r not allowed in INNER CLASSES ?" Watch "y static var r not allowed in INNER CLASSES ?" New topic
Author

y static var r not allowed in INNER CLASSES ?

priyaj jaydeep
Greenhorn

Joined: Sep 20, 2005
Posts: 15
hi,
could anyone pls tell me why static variables are not allowed in Inner classes (which are not static themselves) ?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

I don't think there is any strong rationale besides that they're not really needed. It's possible that disallowing them made implementing the compiler a bit easier. In any case, there's really no case in which you can't simply place the static in the enclosing class for the exact same effect.

You may also find some useful info here.
[ October 20, 2005: Message edited by: Ernest Friedman-Hill ]

[Jess in Action][AskingGoodQuestions]
priyaj jaydeep
Greenhorn

Joined: Sep 20, 2005
Posts: 15
sorry ! I was not aware of the "Use real words" rule
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Originally posted by priyaj jaydeep:
sorry ! I was not aware of the "Use real words" rule


I don't know if this is a strict rule. It's more part of the etiquette of the Internet (i.e. netiquette). Since this is a technical, and somewhat professional forum, you will be taken more seriously if you use correct English, especially typing out words instead of using IM-style abbreviations. It will also help our international audience to understand more clearly.

Thank you,

Layne


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: y static var r not allowed in INNER CLASSES ?