Answer Posted / ranganathkini
A class has a constructor so that when an instance of the
class is created, the fields of the class can be setup to a
initial valid state.
Abstract classes define partial implementation of a public
contract. Which means that it may implement some of the
methods and contains partially implemented methods that are
marked abstract.
Since abstract classes can have partial implementation and
such partial implementation can include fields of the class,
a constructor becomes necessary so that those fields are
initialized to a valid default state when they are created
thru the constructor of their concrete subclasses.
| Is This Answer Correct ? | 12 Yes | 4 No |
Post New Answer View All Answers
Is treeset sorted in java?
What is methodological theory?
What is the difference between Error, defect,fault, failure and mistake?
What is variable and constant explain with example?
Explain inner classes ?
How many tetrahedral voids are there in bcc?
What is unmodifiable list in java?
Can we use catch statement for checked exceptions?
What is maximum size of arraylist in java?
what is the difference between future and callable interface in java?
Explain the difference between association, aggregation and inheritance relationships.
What is a module function?
What are the different types of java?
What does the exclamation mark mean in java?
What is the difference between heap and stack memory?