Threads? There is too big of gap in my knowledge to complete this task. I know as programmers we are supposed to research on our own (which I do) but I feel there is some prerequisites I need to learn in order to successfully understand not only the task but "Threads" as well. If I'm not mistaken, Threads is something learnt between levels 11-20? and this task is still in level 8. sooo. Perhaps someone could point me to a resource to understand Threads better or help me with this question. Please. Thank you so much.
This is an odd task at this stage.
Under discussion
Comments (11)
- Popular
- New
- Old
You must be signed in to leave a comment
sergio
9 August 2021, 03:10
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
0
Michael
16 April 2021, 10:10
Please go easy! I understand your frustration because I also often struggle with difficult tasks and I sometimes think it is too much for me. But getting to the solution with the help of the community or on one's own is the perfect learning strategy.
Now in the case of this tasks, just let the main methode throw the InterruptedException and then implement the thread before the iterator is printed. That's all.
+1
Glenn Meyer
16 November 2019, 13:00
Using JDK 1.8.0_221, I could not get this to work by only adding
to the loop. I had to add a try catch like this: https://stackoverflow.com/questions/23283041/how-to-make-java-delay-for-a-few-seconds/23283072
+1
Thomas Sixberry
28 January 2020, 03:10
I don't use IntelliJ IDEA since this codegym.cc is outdated. Perhaps, I should so I learn the up-to-date ways of doing things!
0
Noam G
10 August 2019, 12:56
Can't under why you ranting about it. they basically gave you the answer.
+4
Thomas Sixberry
28 January 2020, 03:09
I read it and thought, "am I only suppose to type Thread.sleep(100) and that is it? no way."
Then it told me to throw.. thought ahh, theres the kicker.
0
tony
6 January 2019, 10:45
+3
Daniel Knox
11 December 2018, 11:20
Your ide should help you out with this one by suggesting adding throw clause (throws InterruptedException)
and/or adding try/catch
+1
kapil
2 November 2018, 11:14
use ...throws InterruptedException..in main method
+5
Pavlo Plynko Java Developer at CodeGym
17 October 2018, 07:24
When you run your code, it always works in thread. If you need suspend code working - use Thread.sleep(100);
That is all prerequisites you may need for this task.
+1
Khurram
16 October 2018, 18:35
you dont require Thread knowledge for this task. it pretty much tells you what to do in requirement 4.
+1