What is meant by constructor?

Answer Posted / shiva

java allows objects to initilize themselves when they are
created .this automatic initilization is done wih the use
of constructor .a constructor is a special type of method
that has the same name of its class.when ever an object of
class is created,its constructor will be invoked and it
will initilized the object.the return type for a
constructor is not defined as it implicitly takes its class
type as return type.

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is generic type?

783


When is the finalize() called? What is the purpose of finalization?

811


Explain the difference between throw and throws in java?

764


Tell me the latest versions in java related areas?

820


What is a constructor, constructor overloading in java?

740


What are the restriction imposed on a static method or a static block of code?

798


What does += mean coding?

712


How do I run java on windows?

752


How do you read and print a string in java?

717


What is a nested structure?

716


Why map is used in java?

784


How does finally block differ from finalize() method?

801


take an array with -ve and +ve value both.find out the nearest value of 0(zero).if two values are same like(-2 and +2)then extract +2 is nearest of 0(zero).

1748


Which class cannot be a subclass in java?

712


How do you find the maximum number from an array without comparing and sorting?

859