日期:2014-05-20 浏览次数:21017 次
openButton.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event){
openFile();
if (fileName == null)
return;
analysisFileOrDir(fileName);
for(File file : list){
analyze(file);
}
}
});
------解决方案--------------------
------解决方案--------------------
this.getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session)throws HibernateException, SQLException {
criteria.setProjection(Projections.rowCount());
return (Integer) (criteria.list().iterator().next());
}
});
------解决方案--------------------
为什么叫“匿名内部类”?
这里明显是定义了一个没有名字的对象,
我觉得应该叫“匿名对象”比较合适
------解决方案--------------------
interface C {
public void g(); // 1#
}
class D {
public void h(C c) {// 2#
c.g();
}
public static void main(String[] args) {
D d = new D();
d.h(new C() { // 3#
@Override
public void g() {
System.out.println("ok");
}
});
}
}
class A {
public void f() {
System.out.println("A");
}
}
class B {
A a = new A() { // 1#
@Override
public void f() {
System.out.println("B");
}
};
}