SCJP1.4
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
*Winston Churchill
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Originally posted by Bindesh:
"An inner class is a nested class that is not explicitly or implicitly declared static"
Does this mean that a nested class that is declared static is not an inner class.
And what does this mean
"Nested classes that are not inner classes may declare static members freely, in accordance with the usual rules of the Java programming language"(JLS 8.1.2).Any codes to explain this.
Nupur. <br />SCJP2.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
A non-static nested class is called an inner class. An inner class can not declare a static member unless it is a compile time constant. Even though f is final, it does not have a value at compile time and therefore it causes a compilation error. Member variable g also causes a compiler error because it is static. The static initializer of NonStaticInner causes a compiler error because inner classes can not declare static initializers.
Compiler error at line 12.
Compiler error at line 13.
Compiler error at line 15.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
SCJP1.4
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
*Winston Churchill
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Let us be showered in the light of confusion!
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
pie. tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|