Ann Cabrera

Greenhorn
+ Follow
since Aug 12, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ann Cabrera

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



maybe you can try to insert this if no one has answered your question yet:
f.p.pop();