About Question enthuware.ocpjp.v7.2.1331 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
jaypi
Posts: 8
Joined: Sun Feb 03, 2013 9:47 am
Contact:

About Question enthuware.ocpjp.v7.2.1331 :

Post by jaypi »

I don't understand the question...

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

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

Post by admin »

It is asking what happens when you call the put method.
If you like our products and services, please help us by posting your review here.

jagoneye
Posts: 97
Joined: Wed Dec 28, 2016 9:00 am
Contact:

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

Post by jagoneye »

It would be a lot helpful if someone would post which classes allow null key/values insertion and which not.

maarten03
Posts: 5
Joined: Fri Nov 18, 2016 10:49 am
Contact:

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

Post by maarten03 »

FYI: The function returns the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key.)

I was doubting.

lenalena
Posts: 56
Joined: Tue Feb 21, 2017 4:24 pm
Contact:

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

Post by lenalena »

No Nulls: ArrayDeque, Hashtable, TreeSet, ConcurrentHashMap, ConcurrentSkipListMap (and most other concurrent collections)
No Null Keys: TreeMap

Everything else is OK with null, as much as I was able to gather...

Badem48
Posts: 26
Joined: Thu Aug 24, 2023 4:33 pm
Contact:

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

Post by Badem48 »

I am confused about the put() method signature.
The signature of put() method in HashMap is V put(K key, V Value);
Where is that signature with objects coming from?

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

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

Post by admin »

V and K are type parameters. They are relevant only while compilation. After compilation, they are replaced by Object (or their bounds).
If you like our products and services, please help us by posting your review here.

Badem48
Posts: 26
Joined: Thu Aug 24, 2023 4:33 pm
Contact:

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

Post by Badem48 »

Yes that is correct.

Post Reply

Who is online

Users browsing this forum: No registered users and 50 guests