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

What is object english?

834


What is :: operator in java?

718


Explain wrapper classes in java?

772


I am a fresher and know core java, c languge, html, css etc if I am illegible for any job then send it on my email tatranakshay276@gmail.com

1383


Which sorting algorithm is in place?

737


What is multithreading in java?

798


If a method is declared as protected, where may the method be accessed in java programming?

721


How do you compare values in java?

806


What is use of functional interface in java 8? Explain

783


Can you inherit a constructor java?

831


What is subsequence of a string?

854


Why inputstreamreader is used in java?

786


What are the 2 types of java programs?

811


Explain reverse a linked list recursive java solution?

759


Which class represents the socket that both the client and server use to communicate with each other?

820