This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Inner and Abstract class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Inner and Abstract class" Watch "Inner and Abstract class" New topic
Author

Inner and Abstract class

Anupama D S
Greenhorn

Joined: Jan 31, 2008
Posts: 4
Hi all


Is it legal(not in terms of syntax) to define inner class inside abstract class does it comes under any design pattern?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32654
    
    4
You would appear to have missed the JavaRanch naming policy when you signed up. Please check it and amend your displayed name in "my profile."

I think it is legal to declare such an inner class, yes, but if you give it private access it can only be used inside the abstract class. I don't know what pattern name you would put to that.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Originally posted by Anupama D S:
Is it legal(not in terms of syntax) to define inner class inside abstract class does it comes under any design pattern?


If "not in terms of syntax", then what?

Anyway, the answer is yes, it is legal to have an inner class inside an abstract class.

Further, as well as being legal, it is also sometimes a reasonable thing to do. After all, an abstract class contains (partial) implementation code, and that implementation will sometimes be best achieved with the help of an inner class.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
As stated, it would be perfectly reasonable to implement an abstract class, and have one or more inner classes that "complete" the implementation within the same file.

Designs are just names that people have put to common design problem/solutions. It's just likely not that common.


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Inner and Abstract class
 
Similar Threads
Innner Class
inner class
inner class
inheritance n inner classes
inner classes