Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
I was looking at an example where a class had 2 different constructors, each was different in the parameter list by having different types and numbers of parameters. How can this be, I don't understand this can someone explain why people do this, what is it used for?
Originally posted by Maulin Vasavada:
i agree 100% that constructors are methods with special convention/restrictions (if u will)...
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Originally posted by Barry Gaunt:
I believe that it is because of all the "special convention/restrictions" one can say that constructors are not methods. The JLS also distinguishes between methods and constructors in Section 8, and uses the terms "methods or constructors" or "methods and constructors" throughout. I also found that keeping in mind the idea that "constructors are not methods" got me more than a few points when taking the SCJP recently.
I wasn't selected to go to mars. This tiny ad got in ahead of me:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|