Can you have a constructor in abstract class?
Answer Posted / suresh
any class which extends with an object class should have a
constructor whether a class is abstract class or not.
if a abstract class is super class to some sub classes,
then the abstract class should extneds with oject class.
EX: abstract class A{
A{
super(); /// it ll give a call to super class
/// super() we can use only in
constructor
}
}
class B extends A{
}
means any class should extnd with super class.
because of this abstract classes are not 100% abstract.
interface is 100% abstract.
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Is java hashset ordered?
What is the difference between delete and delete[]
What are generic methods?
What is meant by design patterns?
When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?
Why constructor has no return type?
what is singleton class in java?
Is the milky way in a void?
is there a separate stack for each thread in java? : Java thread
How are this() and super() used with constructors in java programming?
What is the indent key?
Is 0 an even number?
How to reverse a string in java?
Is arraylist an object in java?
What is thread count in java?