In this ElementK training I'm doing on the section on constructors it enumerates the steps involved in constructing an object. The first step says "Bind Constructor Parameters".
Not understanding what this means I googled it and found out that it is from the Sun (Now Oracle) tutorials. Still not clear what it means. Would appreciate any insight...
It would be helpful if you'd post a link to what you don't understand or repeat it here, providing the source, of course. Add detail as necessary to describe what you don't understand. Just doing that may help you understand, but it'll definitely help us.
Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Joined: Mar 26, 2011
Thanks for response!
I can't post a link since one needs to log on to access the training material but here I am posting the relevant transcript
Constructing and Initializing Objects
For object initialization first the memory is allocated and default values for the instance variables are assigned. Then, the instance variable initialization uses the following steps recursively:
1) Bind Constructor parameters 2) If explicit this(), call recursively, and then execute the body of the current constructor
3 more steps
Joined: Oct 24, 2010
This link does not use the term "Bind," but it does provide an overview of arguments and parameters in constructors and methods. I'm going to make a guess that "bind constructor parameters" means to assign the parameters passed to the constructor to the class fields and variables. For example,
the two lines I've written in the constructor "binds" the arguments passed to the constructor to the class fields of the same name.
As I said, I'm guessing. If it were a term I could find in the Sun/Oracle tutorials, I'd point you to it, but I couldn't find it. Besides, you can look as well as I can.
That December 2010 posting has confused you. It is in fact possible to call instance methods from the constructor, but only after the super() call has been completed. It may not always be a good idea to call instance methods from the constructor, but it is possible.
Joined: Mar 26, 2011
Thanks Campbell- I posted that older link not because I'd a question (or, as we say back in India, a doubt) about calling instance methods from w/in the constructor. I was just saying that in one of the responses to that post someone had mentioned the concept of "Bind constructor parameters"- topic of my original question.
Having said which I appreciate your insight- thanks for pointing it out!