Let's count

  • 9
  • Locked
1. Make it so that the result is calculated for all the array elements, WITHOUT using Thread.sleep in the main(String[] args) method. 2. Correct the synchronized block so that the values array is filled with 1s
You can't complete this task, because you're not signed in.
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Level 22 , Iasi, Romania
23 August 2021, 17:59
this task makes absolutely no sense. they ask you to correct the code so the array is filled with '1's but the "right solution" doesn't do that.
Jen P
Level 26
4 August 2019, 22:25
Help! I don't understand why I should synchronized `values` but not syncrhonized `Solution.values` ? `values` is a static variable in class Solution and all counters are actually accessing the same `Solution.values`, then why the answer is just `values` ? Thank you!!
Level 20 , Poland
3 August 2020, 06:00
this is the same. although Solution.values is legal we are calling it from within a Solution class so we are in the scope of this variable. using Solution.values instead of values is superfluous.