if you want to use abstract class or interface as new instance and don't want to create a class that extends abtract class or implements interface ,you can do like this:
interface=new interface(or abtract class)
{
//in this rigion ,implements all the method needed(e.g. abstract method,method in interface)
.......
}
this use in the case that one interface has many implements which just be used once ,so this way is a lazy but good way.
this way called "Anonymous class";
posted on 2006-09-28 12:29
R.Zeus 阅读(383)
评论(0) 编辑 收藏 所属分类:
J2SE