Can you have a constructor in abstract class?
Answer Posted / rajesh dangi
I don't understand why ppl start writing responses without
writing a small code to confirm it.
Guys an abstract class too can have a constructer. Any time
a class inheriting an abstract class is instantiated, its
constructer would first call the constructor of the
abstract class. Try it yourself.
Plus, the method in the abstract class with the same name
(i.e. its constructer) is always considered as a
constructer and not any regular method. Even when the
constructer is public, you can not invoke the constructer
of an abstract class in a sub class inheriting the abstract
class. That method can not be invoked by our code since it
is an abstract class and can not be instantiated by us
| Is This Answer Correct ? | 62 Yes | 6 No |
Post New Answer View All Answers
What is the purpose of encapsulation?
How do you achieve singleton?
What is factor r?
What is jit compiler ?
What is a literal coding?
List some important characteristics on jre
What is the preferred size of a component in java programming?
What is the difference between keyword and identifier?
How do I type unicode?
I am unable to find or learn about print command. I have a graphical program in core java in applet but i want to give print command but i have coding for that so if anyone know about this plz mail me on avdhesh_chauhan007@yahoo.co.in
When a thread is executing synchronized methods , then is it possible to execute other synchronized methods simultaneously by other threads?
What is tree in java?
Why put method is idempotent?
Why is a singleton bad?
What is time complexity algorithm?