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

Which is better 64 bit or 32 bit?

0 Answers  


what is the constructor and how many types of constructors are used in java?

0 Answers  


how we can make a read-only class in java?

0 Answers  


What is nan inf?

0 Answers  


What is race condition ?? (Threading concept) TCS 2 sept10

3 Answers   SparkTG, TCS,






What are the advantages of compiled language?

0 Answers  


What is bytecode verifier?

0 Answers  


Why bytecode is called bytecode?

0 Answers  


What is token in java?

0 Answers  


Is an object null?

0 Answers  


What are pass by reference and pass by value?

0 Answers  


What is your platform?s default character encoding and how to know this?

0 Answers   TCS,


Categories