Java动态代理小例子.

例子

1,先创建teacher接口

1
2
3
public interface Teacher {
void manageWork(String s);
}

2,创建teacher实现类

1
2
3
4
5
6
7
8
9
public class TeacherA implements Teacher {

@Override
public void manageWork(String s) {
// TODO Auto-generated method stub
System.out.println(this.getClass().getSimpleName()+"开始布置作业:"+s);
}

}