File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "abstract class" Watch "abstract class" New topic

abstract class

varungoyal goyal
Ranch Hand

Joined: May 31, 2006
Posts: 37
can we declare a constructor of abstract class in any case.
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.

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:


all events occur in real time
I agree. Here's the link:
subject: abstract class
Similar Threads
HttpServlet class
A question about container!
usage of a class
A mock question