Runnable
的 run
方法返回类型为 void
,不能返回值。然而,我想知道是否有任何解决方法。
我有一个像这样的方法:public class Endpoint {
public method() {
Runnable runcls = new RunnableClass();
runcls.run()
}
}
这个方法 run
是这样的:
public class RunnableClass implements Runnable {
public JaxbResponse response;
public void run() {
int id = inputProxy.input(chain);
response = outputProxy.input();
}
}
我想在method
中访问response
变量,这是可能的吗?
response
?或者更好的是,outputProxy
? - Less