This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Anonymous Inner Class basic dought  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Anonymous Inner Class basic dought  " Watch "Anonymous Inner Class basic dought  " New topic
Author

Anonymous Inner Class basic dought

Dhanushanth Dhanu
Greenhorn

Joined: Jul 10, 2010
Posts: 16

Here if i named all method as m() it is printing A,B........



but if i change the static inner class method name as m1() it is printing A,A.
what is happening here ........
can any one give me a explanation about this............
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
What is the source of these questions? Which book or site are you using?

Please see: QuoteYourSources

Much luck!
Dhanushanth Dhanu
Greenhorn

Joined: Jul 10, 2010
Posts: 16
Dhanushanth Dhanu wrote:
Here if i named all method as m() it is printing A,B........



but if i change the static inner class method name as m1() it is printing A,A.
what is happening here ........
can any one give me a explanation about this............
Poobhathy Kannan
Ranch Hand

Joined: May 26, 2004
Posts: 94
In your first example, you override the method m() of A. so when you call x.m(), the overridden method is called and it prints "B".

But in the second, you have a new method m1(). so when you call x.m(), the inherited method is called and prints 'A'.

And i doubt whether you can call it as " static inner class ". it is just a static variable refers to a Anonymous inner class


http://learnertobeginner.blogspot.com/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Anonymous Inner Class basic dought