Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Originally posted by Barry Gaunt:
...Any ideas why the fully qualified name of the class variable is not allowed?
Originally posted by Mr. C Lamont Gilbert:
FinalStaticInit != StaticFinalInit
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
*** Semantic Error: The final field "i" may not be assigned in a qualified expression. Use a simple name instead.
"I'm not back." - Bill Harding, Twister
"I'm not back." - Bill Harding, Twister
Similarly, every blank final variable must be assigned at most once; it must be definitely unassigned when an assignment to it occurs. Such an assignment is defined to occur if and only if either the simple name of the variable, or its simple name qualified by this, occurs on the left hand side of an assignment operator. A Java compiler must carry out a specific conservative flow analysis to make sure that, for every assignment to a blank final variable, the variable is definitely unassigned before the assignment; otherwise a compile-time error must occur.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
"I'm not back." - Bill Harding, Twister