public class interface_class {
int aaa=3652;
int getdata(CALL call){
call.get_in(aaa);
return 1;
}
}
interface CALL {
void get_in(int abc);
}
看代码:
public class callbacttest {
public static void main(String[] args) {
int x= new interface_class().getdata(new CALL() {
@Override
public void get_in(int bbbb) {
System.out.println(bbbb);
}
});
System.out.println(x);
}
}
结果:
3652
1
将数据已接口的形式外露: