wood burning stoves 2.0*
The moose likes Java in General and the fly likes abstract class 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 » Java in General
Bookmark "abstract class" Watch "abstract class" New topic
Author

abstract class

varungoyal goyal
Ranch Hand

Joined: May 31, 2006
Posts: 37
can we declare a constructor of abstract class in any case.
thanks
Kia Phia Ben
Ranch Hand

Joined: Dec 16, 2005
Posts: 48
Hi varungoyal goyal
I think you can create constructor of abstract class when you call it in constructor of subclass
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Hi varungoyal,

can we declare a constructor of abstract class in any case.
thanks



Why do you post this question in a forum?
You can test it yourself in a minute.

Anyway, the answer is yes. Every class - also abstract classes -
MUST have a constructor. If you don't provide one, the default constructor will be used.

Below an abstract class with a constructor, and a concrete class extending the abstract one:






Yours,
Bu.


all events occur in real time
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: abstract class