aspose file tools*
The moose likes Java in General and the fly likes static final variable in non-static Inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "static final variable in non-static Inner class" Watch "static final variable in non-static Inner class" New topic
Author

static final variable in non-static Inner class

Prakash Rai
Ranch Hand

Joined: Jan 10, 2011
Posts: 103



As we say that static declaration is not Allowed in Non-static Inner class . Then why static final variable is allowed?
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Because the compiler can get rid of the variable and just replace all uses of it with the constant.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: static final variable in non-static Inner class