Why it is necessary to add synchronized to method4, but not to method5?
Denys
Level 41
Why 4???
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Mike McKenna
5 December 2020, 23:10
Hi Denys,
requirement states use synchronized in method 5 if necessary . since I can't see u r code
here we go. method 4 we used (sb.) = String Builder which is not thread safe .
method 5 use new String Buffer() which is thread safe .
only trying to help .
0