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

In java, how we can disallow serialization of variables?

0 Answers  


why the primitive data type have classes?

4 Answers  


Name the method of a Container that can be used to cause a container to be laid out and redisplayed?

1 Answers  


What is the benefit of inner classes in java?

0 Answers  


Why java is secure? Explain.

0 Answers  






How will you convert an ArrayList to Arrays?

4 Answers   KPIT,


what is the use of clone method? why user cant overwrite in sub class without its proper defination.

2 Answers   TCS,


What is the difference between Checked and Unchecked exception? Give some examples

2 Answers   Ness Technologies,


How hashset works internally in java?

0 Answers  


what are the uses of Class class and what it returns? explain it with the example code.

1 Answers  


What is the difference between applet and application?

0 Answers  


In which way does a Primitive data type is passed ?

5 Answers   Sun Microsystems,


Categories