While Going through the java tutorial on sun site, I see following piece of code:
for (int i = 0; i < inputs.length; i++) {
heavyCrunch(inputs[i]);
if (Thread.interrupted()) {
//We've been interrupted: no more crunching.
return;
}
}
Since Thread.interrupted() is a static function, how does java knows which thread is calling it? eg. I expected it to be of type: this.interrupted() or Thread.interrupted(this).