In the following code I create a callable which creates a Runnable inside the call()-method. My problem is that run()-method is never reached (code does not get executed). Do you know why and how to fix that?
public static void main(String[] args) {
Callable<Object> c = new Callable<Object>() {
@Override
public Object call() throws Exception {
Runnable r = new Runnable() {
@Override
public void run() {
System.out.println("hi");
}
};
return null;
}
};
try {
c.call();
} catch (Exception e) {
}
}
r.run();