Why do local inner classes not allow static variables ? The static fields of the classes could at least have been allowed access from the local method ?
daudiam
-6
Junior Poster
Recommended Answers
Jump to PostActually not 100% true. Static variables can be used if declared final]/i] which is good for the serialVersionUID.
I guess it is just because it would be to difficult (or time consuming at run time) to implement because the Java Virtual Machine has restrictions on calling private members from …
Jump to PostWhy do local inner classes not allow static variables ? The static fields of the classes could at least have been allowed access from the local method ?
Because static members make little sense when it comes to "local inner classes" since these classes belong to a scope as opposed …
All 5 Replies
pbl
22
Junior Poster
lcy320stud
0
Newbie Poster
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
daudiam
-6
Junior Poster
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.