Interviews2 answers
Why Constructor have not return type
2 Answers
constructor is a special method
in java. the purpose of the constructor is to assign values to the
instance variable when the object is created for the first time. the
name of the constructor is same as the class name. to call the
constructor in two ways.with new operator eg: Test t1=new Test(); here
Test() is nothing but to call the construtor of class.with
newInstanceOf() method in Class class eg: object
obj=class.newInstance();
kanchan setiaPosted Feb 2, 2011, 7:40 PM EST
This is alright to ask on forums such as this.I would be more intrested in getting to know that exact questions like the one you posted; have you tried to Copy and Paste it on Google.com ?
knightsPosted Jan 31, 2011, 11:21 AM EST