Which class(es) safely protects the doIt () method from concurrent thread access?

Which class(es) safely protects the doIt () method from concurrent thread access?

Which class(es) safely protects the doIt () method from concurrent thread access?

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:

only A und D possible
It should be pointed out that:
public void blah() {
synchronized (this) {
// do stuff
}}
is semantically equivalent to:
public synchronized void blah() {
// do stuff
}
Incorrect answer:
B: A constructor cannot be synchronized. () Object cannot be resolved to a type
C: in static context (static void main !) no reference to this possible



Leave a Reply 25

Your email address will not be published. Required fields are marked *


Luiz

Luiz

Just D is the correct answer

l0c

l0c

A isn’t correct indeed; The string object that is passed can very well be a different string object all the time. Therefore, the lock has no use.

With answer D, you are guaranteed to always lock the very same object.

Lore Lemmond

Lore Lemmond

I think this is one of the most important information for me. And i’m glad reading your article. But should remark on some general things, The website style is perfect, the articles is really nice : D. Good job, cheers

http://www.RQDKEDRThS.com/RQDKEDRThS

Google

Google

That will be the finish of this article. Here you will locate some internet sites that we consider you will value, just click the links.

vigra

vigra

Here are a few of the web pages we suggest for our visitors

make a app

make a app

usually posts some very intriguing stuff like this. If youre new to this site

free app maker

free app maker

just beneath, are many absolutely not associated web-sites to ours, even so, they are certainly worth going over

home decor

home decor

that would be the end of this write-up. Here youll locate some internet sites that we think youll enjoy, just click the hyperlinks over

Free online games

Free online games

although sites we backlink to below are considerably not connected to ours, we feel they’re truly worth a go via, so possess a look

slot machine gratis da scaricare

slot machine gratis da scaricare

very couple of internet websites that occur to become in depth beneath, from our point of view are undoubtedly very well worth checking out

Auto Protection Options

Auto Protection Options

although web sites we backlink to beneath are considerably not related to ours, we really feel they are in fact worth a go by way of, so have a look

Fenster

Fenster

one of our guests recently suggested the following website

itech

itech

very few internet websites that happen to be detailed beneath, from our point of view are undoubtedly effectively really worth checking out

SEO services in Lahore

SEO services in Lahore

Here is an excellent Blog You may Find Exciting that we Encourage You

Play Games Online Free

Play Games Online Free

very few internet sites that take place to become comprehensive below, from our point of view are undoubtedly well worth checking out

Mens Divorce Law Firm

Mens Divorce Law Firm

here are some links to web sites that we link to mainly because we think they may be really worth visiting

make your own app

make your own app

please take a look at the web sites we comply with, such as this one, because it represents our picks through the web

keeping your feet healthy on the battlefield

keeping your feet healthy on the battlefield

we like to honor lots of other net sites on the net, even if they arent linked to us, by linking to them. Under are some webpages really worth checking out

omaha computer repair

omaha computer repair

Here are several of the internet sites we suggest for our visitors

Youtube for the Miracle Pianist Cool

Youtube for the Miracle Pianist Cool

the time to study or go to the subject material or web sites we have linked to below the

Turen

Turen

although sites we backlink to below are considerably not associated to ours, we really feel they may be essentially worth a go by way of, so have a look

Turen

Turen

Sites of interest we have a link to

seniorcare

seniorcare

here are some links to websites that we link to because we assume they’re worth visiting

Forged steel globe valve

Forged steel globe valve

The data talked about inside the post are a few of the most beneficial accessible