Abstract - How do you make object

If all the methods in the Abstract class is defined, then it is a Abstract class? And can we make object out of it?

Questions by Sujit4175   answers by Sujit4175

Showing Answers 1 - 4 of 4 Answers

First thing first, An abstract class without any abstract method means you are loosing the main intent fo abstractness, why we are making abstract class is to provide some of common implementation and ask its subclasses to implement specific behaviours by its own.
Now answer of your question is YES , we can create abstract class without any abstract method in it,now here the question is where exactly we can use this kind of design where we have an abstract class without any abstract method, so the answer is if we want to provide some basic implementation and doesn't want to instantiate the class then you can use this approach. For example : HttpServlet class is an abstract class with all concrete methods but we can't instantiate it , you have to create your own custom class which will extend HttServlet class and use all HttServlet specific behaviours.

Hope this will help you to understand.

sampra

  • Mar 16th, 2012
 

we cant create the instance of abstract class ..here we need sub class which extended this class .we can have ref var of abstract class

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions