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
What is object english?
What is :: operator in java?
Explain wrapper classes in java?
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
Which sorting algorithm is in place?
What is multithreading in java?
If a method is declared as protected, where may the method be accessed in java programming?
How do you compare values in java?
What is use of functional interface in java 8? Explain
Can you inherit a constructor java?
What is subsequence of a string?
Why inputstreamreader is used in java?
What are the 2 types of java programs?
Explain reverse a linked list recursive java solution?
Which class represents the socket that both the client and server use to communicate with each other?