why the abstract class has default constructor?

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


Please Help Members By Posting Answers For Below Questions

Difference between object and reference?

894


Addition to previous section relative word 5th one was Putrid ans: rotten, also there was prob. in 1st section on bucket weight ans:10kg, also there was a prob. on train speed to find bridge length ans:800 mtrs.

1826


What is generic class?

845


What is the use of math abs in java?

740


What is hash code collision?

808


Does java runtime require a license?

772


What is serial version uid and its importance in java?

815


How will you call an Applet using Java Script Function?

747


what is thread? What are the high-level thread states? Or what are the states associated in the thread? : Java thread

759


Explain java coding standards for methods?

808


How do you convert bytes to character in java?

733


What checkbox method allows you to tell if a checkbox is checked?

762


Give differences between Quicksort &Mergesort. When should these sorts be used andwhat is their running time in java?

940


What is adapter in java?

712


Explain the difference between collection api and stream api in java8?

729