a.Add(12);a.Add(1);a.Add(0);a.Add(10);a.Add(4);a.Sort();
Interviews2 answers
One threading is printing 2,4,6,8,10 all even numbers and another thread is printing 1,3,5,7,9 all odd number, how you will print 1 to 10 in sequential manner
2 Answers
jn_neeleshPosted Jun 23, 2022, 7:26 AM EDT
I think create a volatile sorted list class level variable and assign the values in the each thread, once both of the threads are finished, iterate through the sorted list to print the outcome? Please correct me.
Raj GuptaPosted Jan 6, 2022, 8:24 PM EST
