public class ThreadTest extends
Thread {
public void run() {
System.out.println("Before sleep");
try {
this.sleep(1000);
}
catch (InterruptedException ie) { }
System.out.println("After sleep");
}
public static void main(
String[] args) {
ThreadTest a = new ThreadTest();
a.start();
}
}
The above program compile and run. Can somebody explain why this.sleep(1000) works here? Is it because sleep() is used in the run() method which is non-static?