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
Just D is the correct answer
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.
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
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.
Here are a few of the web pages we suggest for our visitors
usually posts some very intriguing stuff like this. If youre new to this site
just beneath, are many absolutely not associated web-sites to ours, even so, they are certainly worth going over
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
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
very couple of internet websites that occur to become in depth beneath, from our point of view are undoubtedly very well worth checking out
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
one of our guests recently suggested the following website
very few internet websites that happen to be detailed beneath, from our point of view are undoubtedly effectively really worth checking out
Here is an excellent Blog You may Find Exciting that we Encourage You
very few internet sites that take place to become comprehensive below, from our point of view are undoubtedly well worth checking out
here are some links to web sites that we link to mainly because we think they may be really worth visiting
please take a look at the web sites we comply with, such as this one, because it represents our picks through the web
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
Here are several of the internet sites we suggest for our visitors
the time to study or go to the subject material or web sites we have linked to below the
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
Sites of interest we have a link to
here are some links to websites that we link to because we assume they’re worth visiting
The data talked about inside the post are a few of the most beneficial accessible
d