Answer Posted / bindhu
Constructor is special type of member function that will
automatically invoke when an object creates. The purpose of
constructor is for the initialization of instance
variables. A constructor having the same name as that of
class name. It may have arguments but doesn't return
anything.
If we want to initialize all objects of the same class
with same values, use default constructor.Otherwise, we can
use parameterized constructor if we want to initialize
objects of the same class with different values. If we
don't specify any constructor , compiler will use default
constructor with garbage value.
Is This Answer Correct ? | 35 Yes | 4 No |
Post New Answer View All Answers
How will you get the platform dependent values like line separator, path separator, etc., ?
Explain a situation where finally block will not be executed?
What is the collections api?
Do you know why doesn't the java library use a randomized version of quicksort?
What is ide with example?
What are the application of stack?
What is difference between filereader and bufferedreader?
What are the differences between stringbuffer and stringbuilder?
What is variable argument in java?
Explain about data types?
Explain about the main() method in java?
Can you create an object of an abstract class?
What are the two ways of implementing multi-threading in java?
What methods are used to get and set the text label displayed by a button object?
Which variables are stored in heap?