About Question enthuware.ocpjp.v11.2.3064 :

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
dimitrilc
Posts: 34
Joined: Sat Jun 06, 2020 4:51 pm
Contact:

About Question enthuware.ocpjp.v11.2.3064 :

Post by dimitrilc »

Hello, for option B, it is not clear why x is typed to Object.

This explanation
Map has a method named keySet(), which returns Set<K>.
does not make a lot of sense here. I think it is clearer to say either
1:
Properties extends Hashtable<Object, Object> (note the concrete generic type of Object), so all references to K, V declared in Hashtable<K, V> become Object, Object. Just saying that Properties extends Hashtable is not enough; It should be Hashtable<Object, Object>.
2:
Properties overrides keySet() (and a bunch of other methods) to explicitly return Set<Object> in its source code

Code: Select all

    @Override
    public Set<Object> keySet() {
        return Collections.synchronizedSet(map.keySet(), this);
    }

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

Re: About Question enthuware.ocpjp.v11.2.3064 :

Post by admin »

It is explained in the explanation to the first option (just above the second one). Even so, the explanation has now been enhanced to make it clearer.
thank you for your feedback!

Deleted User 6318

Re: About Question enthuware.ocpjp.v11.2.3064 :

Post by Deleted User 6318 »

How is this _ used as a keyword? What is purpose of that?

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

Re: About Question enthuware.ocpjp.v11.2.3064 :

Post by admin »

noeloo wrote:
Wed Feb 17, 2021 2:23 pm
How is this _ used as a keyword? What is purpose of that?
It has no use or special meaning but it is now in the list of keywords. You can verify it here: https://docs.oracle.com/javase/specs/jl ... ml#jls-3.9

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests