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
What is nested class?
What is the difference between super class & sub class?
what is meant by HQL?
Name component subclasses that support painting in java programming?
When throw keyword is used?
Can you declare a private method as static?
What's the purpose of static methods and static variables?
What is the synonym of string?
What are java packages?
Explain about field hiding in java?
Why can we not override static method?
What is character in data type?
What is unicode in java?
What is array in java?
Explain the difference between jdk, jre, and jvm?