代理方法除了可以
useful when you use frequently composition of classes.
还有什么用吗?而且上面的useful我怎么体会不到啊??
例:
/*
* Eclipse provide a wizard to add delegate methods. In the editor right click
* and then Source > Generate delegate Methods or you define a key binding to
* call the delegate wizard (Window > Prefrences > Workbench > Keys) .
*
*/public final class Ugly{
// ...
private String tomCat;
// ... /**
* delegate method
*/
public char charAt(int arg0) {
return tomCat.charAt(arg0);
}
}
useful when you use frequently composition of classes.
还有什么用吗?而且上面的useful我怎么体会不到啊??
例:
/*
* Eclipse provide a wizard to add delegate methods. In the editor right click
* and then Source > Generate delegate Methods or you define a key binding to
* call the delegate wizard (Window > Prefrences > Workbench > Keys) .
*
*/public final class Ugly{
// ...
private String tomCat;
// ... /**
* delegate method
*/
public char charAt(int arg0) {
return tomCat.charAt(arg0);
}
}
解决方案 »
- [Java][Swing]可以开发多点触摸桌面程序吗?win7系统下
- 菜鸟,求前辈帮个忙解决一下,为什么点击按钮会出现好多新的页面
- J2SE 试题
- 求个java扫描指定文件夹自动生产XML文件的工具类
- 有关进程的问题····请赐教
- 正则表达式解析xml?
- Calentar、getTimeInMillis()、TimeZone
- 辣手的问题!code生成算法
- 请提供测试程序运行时间的代码
- 在 applet 初始化的时候连接数据库,但是在JBuilder 中可以连接到,在打开网页的时候不行。为什么??
- 关于标识符的初级问题,看看它编译后产生几个.class文件
- 请问"1+2*3*(5+6)"这种字符串怎么运算?还有超过Double范围的两个数相加怎么运算?
发帖数:114
结贴数:24
结贴率:21.05%