Page 1 of 1
About Question enthuware.ocpjp.v7.2.1311 :
Posted: Thu Jun 19, 2014 4:52 am
by bptoth
Maybe I don't understand the terminology correctly, but what does "Only top-level nested classes can be declared static" mean?
E.g. in my understanding in the below example class A is the "top-level nested class", and it can apparently embed another static nested class
Code: Select all
public class TestClass {
static class A {
static class B {
}
}
}
Re: About Question enthuware.ocpjp.v7.2.1311 :
Posted: Thu Jun 19, 2014 5:55 am
by admin
Both A and B are top level nested classes by the virtue of they being nested inside another class and also being declared static. So I am not sure what is the issue.
-Paul.
Re: About Question enthuware.ocpjp.v7.2.1311 :
Posted: Wed Jul 16, 2014 7:49 am
by beasanca
Hi, when in the last answer says "Static inner class" it refers to "Static Nested class"?
Because what I´ve understood from oracle docs is that Inner Classes can not be Static.
thanks
Re: About Question enthuware.ocpjp.v7.2.1311 :
Posted: Wed Jul 16, 2014 10:07 am
by admin
There has been a lot of confusion in terminology. As of JSL 7 (
http://docs.oracle.com/javase/specs/jls ... ml#jls-8.1 ) :
A top level class is a class that is not a nested class.
A nested class is any class whose declaration occurs within the body of another class or interface.
An inner class is a nested class that is not explicitly or implicitly declared static.
An inner class is a nested class that is not explicitly or implicitly declared static.
So you are right. It should say static nested class. Fixed.
thank you for your feedback!
Paul.
Re: About Question enthuware.ocpjp.v7.2.1311 :
Posted: Sat Aug 30, 2014 4:39 am
by shareef.hiasat
admin wrote:There has been a lot of confusion in terminology. As of JSL 7 (
http://docs.oracle.com/javase/specs/jls ... ml#jls-8.1 ) :
A top level class is a class that is not a nested class.
A nested class is any class whose declaration occurs within the body of another class or interface.
An inner class is a nested class that is not explicitly or implicitly declared static.
An inner class is a nested class that is not explicitly or implicitly declared static.
So you are right. It should say static nested class. Fixed.
thank you for your feedback!
Paul.

The problem not fixed i have updated version , and still saying on the last answer
A static inner class can contain a non - static inner class.
Re: About Question enthuware.ocpjp.v7.2.1311 :
Posted: Sat Aug 30, 2014 10:20 am
by admin
I see that it has been updated in the question bank. Could you please download the question bank again (even if it is the same version) Here is the link:
http://enthuware.com/downloads/jqplusv7.ets
-Paul.