package com.company;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class Main {
public static class A {
private void toShow(){
B.show();
B.BSetCallBack(callBack);
}
private B.BCallBack callBack = new B.BCallBack() {
@Override
public void callback(String num) {
System.out.println("num:"+num);
}
};
}
public static class B {
private static String num;
public static void show() {
// do show
// ..
num = "1025";
}
public static void BSetCallBack (BCallBack callBack) {
callBack.callback(num);
}
interface BCallBack {
void callback(String num);
}
}
public static void main(String[] args) {
// write your code here
A a=new A();
a.toShow();
}
}
网友评论