why the abstract class has default constructor?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / amandeep
A Abstract Class Can't Have An Default constructor........Cause It Can't Have An Instance Of It.....
| Is This Answer Correct ? | 2 Yes | 10 No |
Explain the difference between collection api and stream api in java8?
what is the use of abstract class and interface with example?
2 Answers Cycore, DNS, Technoram,
What is the difference between size and length in java?
What is javac_g?
Can we have any code between try and finally blocks?
How does arrays sort work in java?
is it possible to add a object in a HASHMAP
What is the formula to calculate percentage?
Can we use catch statement for checked exceptions?
How much ram can a 64 bit processor theoretically?
What is the difference between synchronized and synchronized block?
How many types of design patterns are there?