Originally posted by nadarajah chenththuran:
why do we need this anonymous inner classes in programming practice. I am in the development for 3 yrs. but i have not used this so far. its bit not clear to me.. can anyone explain this with a proper example.. if any proper materials regarding this??plz pointout..
class PopCorn {
public void pop(){
System.out.println("pop 111");
}
public static void main(String[] a){
PopCorn p1=new PopCorn();
p1.pop();
Food f=new Food();
// how can i call the inner inner class object of PopCorn of class Food here ???
}
}
class Food{
public PopCorn p=new PopCorn(){
public void pop(){
System.out.println("pop here");
}
};
}
how can i call the inner class object in my mentioned commented place