About Question enthuware.ocpjp.v8.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
crazymind
Posts: 85
Joined: Mon Dec 24, 2018 6:24 pm
Contact:

About Question enthuware.ocpjp.v8.2.1311 :

Post by crazymind »

Code: Select all

Non-static nested classes, unlike normal package classes, can have any type of accessibility. 
But in Jeanne Boyarsky, Scott Selikoff' book says this regarding Local inner class:
They do not have an access specifier.
They cannot be declared static and cannot declare static fields or methods.
I am not quite sure which one is correct. The non-static inner class can have constant members but no static methods are allowed, right? What about access modifier? thank you!

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

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

Post by admin »

Observe the statements carefully. First one says non static nested classes and second one says local inner classes. Both are correct.
If you like our products and services, please help us by posting your review here.

crazymind
Posts: 85
Joined: Mon Dec 24, 2018 6:24 pm
Contact:

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

Post by crazymind »

admin wrote:
Tue Mar 19, 2019 8:01 pm
Observe the statements carefully. First one says non static nested classes and second one says local inner classes. Both are correct.
Non-static nested classes, unlike normal package classes, can have any type of accessibility.
But in Jeanne Boyarsky, Scott Selikoff' book says this regarding Local inner class:
They do not have an access specifier.
They cannot be declared static and cannot declare static fields or methods.
Are these two conflict each other regarding the access modifier? Thanks

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

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

Post by admin »

Non static nested class:
class Outer{
public|private|protected class Inner{ <<---- Any access modifier
}
}

Local Inner Class :
someMethod(){

class LocalInnerClass { <<--- can't have any access modifer

}

}
If you like our products and services, please help us by posting your review here.

crazymind
Posts: 85
Joined: Mon Dec 24, 2018 6:24 pm
Contact:

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

Post by crazymind »

admin wrote:
Tue Mar 19, 2019 11:24 pm
Non static nested class:
class Outer{
public|private|protected class Inner{ <<---- Any access modifier
}
}

Local Inner Class :
someMethod(){

class LocalInnerClass { <<--- can't have any access modifer

}

}
Thanks, that's what I thought in the first place. I am confused since the solution says non-static classes can have any access modifier but it should exclude local inner class.

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

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

Post by admin »

Sure, enhanced the statement to avoid the confusion.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests