Can you have a constructor in abstract class?

Answer Posted / abdul hannan

Yes. We can have constructor in an abstract class but we can
not directly instantiate it. If the abstract class have no
argument constructor, it will automatically call by the
constructor of subclass through constructor chaining. If
abstract class have constructor with argument, then we need
to call it by super() and pass the argument in it.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Describe how to implement singleton design pattern in struts.

736


When should we create our own custom exception classes?

760


What is a ?

937


Why Java is not pure Object Oriented language?

841


How do I get the | symbol on my keyboard?

757






What's the purpose of static methods and static variables?

765


Can a method be static?

707


Why unicode is important?

652


Why is stringbuffer not immutable?

749


Is vector thread safe in java?

745


Write down program for following scenario. Use java coding standard. You have array list with some words in it..we will call it as dictionary….and you have a arbitrary string containing some chars in it. You have to go through each word of dictionary and find out if that word can be constructed with the help of chars from arbitrary string given. If you find the word print it else print none.

2462


What is the difference between path and classpath variables?

698


How to use arraylist in java netbeans?

704


Explain the available thread states in a high-level?

710


How does regex work?

712