In class Tread there are three methods that have to do with interupts. They all have "interrupt" in their method name. Have a look in the API. A simple way to interrupt is to call method interrupt():
produces something like this, exact location of the exception message in the output will be system dependent.
main ready
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at
test.€42.run(Main.java:31)
0
1
2
3
4
5
6
7
8
9
10
11
12
Yours,
Bu.