why the abstract class has default constructor?

Answers were Sorted based on User's Feedback



why the abstract class has default constructor?..

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

why the abstract class has default constructor?..

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

Post New Answer

More Core Java Interview Questions

Explain about join() method?

0 Answers  


how to print the below in java? * * * * * * * * *

2 Answers  


What is Session and cookies?Explain in detail with an example?

4 Answers   Accenture, CTS,


Does java support multiple inheritances?

0 Answers  


When a lot of changes are required in data, which one should be a preference to be used? String or stringbuffer?

0 Answers  






What is the difference between the font and fontmetrics classes in java programming?

0 Answers  


How do you reverse a string in java without using string buffer?

0 Answers  


What is a super method?

0 Answers  


Is it possible to compare various strings with the help of == operator?

0 Answers  


What is java’s garbage collected heap?

0 Answers  


Can we have more than one package statement in source file ?

0 Answers  


What is a map in java?

0 Answers  


Categories