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

Describe OOP in java?

2 Answers   Syntel,


List any five features of java?

0 Answers  


Can we access a database using applets?

2 Answers   Hewitt,


what is meant by abstract class?

0 Answers   Aspire,


Is there a way to increase the size of an array after its declaration?

0 Answers  


What is the difference between the continue and break statement?

2 Answers  


What is ordered map in java?

0 Answers  


How to override equals() and hashCode() method in java?

1 Answers   Wipro,


class A { private int i; } class B extends A { private int i; } if I create an object of B class what will be the memory of that object.

2 Answers   Yamaha,


how you will prevent inheritance is there any other way other than inheritance?

4 Answers   Wipro,


Describe the Big-O Notation.

0 Answers   Global Logic,


Can I learn java in 3 months?

0 Answers  


Categories