Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
My Linked In
Originally posted by Mo Bustany:
Barry, could you tell me what java 'rule' does my original code violates?? It looks to me it's syntactically correct.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
My Linked In
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
the compiler needs to call the constructor of the enclosing class, in your case AccessControl.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
SCJP 1.4
My Linked In
The rule is that you cannot instantiate a non-static inner class without already having an instance of the enclosing class. If you come to think about it, it makes sense. For instance, you cannot invoke instance methods or access instance member fields of class A without having an instance of the class A.
Already having an instance of the enclosing class or calling the enclosing class' constructor is exactly the same
My Linked In
Calling super() creates an instance which is implicitely at your disposal afterwards. To me, it is the same as having an explicit instance.
My Linked In
Don't get me started about those stupid light bulbs. |