class A implements Runnable {
int i;
public void run () {
try {
thread.sleep(5000);
i= 10;
} catch(InterruptedException e) {}
}
}
public class
test {
public static void main (
String args[]) {
try {
A a = new A ();
Thread t = new Thread (a);
t.start();
t.join();
int j= a.i;
}catch (Exception e) {}
}
}
E:\l>javac test.java
test.java:5: cannot resolve symbol
symbol : variable t
location: class A
t.sleep(5000);
^
1 error
Can somebody tell me why does it compile fail ?
Thanks !!