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 java lang string?
What are the advantages of java over cpp?
What is stringbuffer in java?
How many functional interfaces does java 8 have?
What will happen to the exception object after exception handling?
How are the elements of a gridbaglayout organized?
Can a class be declared as protected?
What is the use of default method in interface in java?
What is oop in java?
What is the difference between import java.util.date and java .util?
Explain try and catch keywords in java?
What is incompatible types in java?
What is an infinite loop?
Which oo concept is achieved by using overloading and overriding?
Are functions objects in java?