public class test {
// public String name;
public void say(String name) {
new RunnableWithReturn() {
@Override
public Object execute() {
System.out.println(name);
return null;
}
};
}
}
interface RunnableWithReturn {
public abstract Object execute();
}
// public String name;
public void say(final String name) {
new RunnableWithReturn() {
@Override
public Object execute() {
System.out.println(name);
return null;
}
};
}
添加參數 final