a
在这里只能是最终版本。为什么?如何在 onClick()
方法中重新分配 a
而不保留它作为私有成员?
private void f(Button b, final int a){
b.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
int b = a*5;
}
});
}
How can I return the 5 * a
when it clicked? I mean,
private void f(Button b, final int a){
b.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
int b = a*5;
return b; // but return type is void
}
});
}