About Question enthuware.ocpjp.v7.2.1311 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
bptoth
Posts: 33
Joined: Mon May 06, 2013 9:41 am
Contact:

About Question enthuware.ocpjp.v7.2.1311 :

Post 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 {
		}
	}
}

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1311 :

Post 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.

beasanca
Posts: 2
Joined: Sun Mar 24, 2013 11:29 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1311 :

Post 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

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1311 :

Post 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.

shareef.hiasat
Posts: 20
Joined: Thu Dec 19, 2013 8:22 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1311 :

Post 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.


:roll: 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.

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1311 :

Post 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.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests