This is a powerful keyword used in Java. How is it used and why is it so beneficial? Give an example in your explanation. (Chapter 6 & 8 both cover this topic).
A - The "this" reference allows for greater flexibility when coding. By utilizing the "this" reference, it makes it easier for both the programmer and the complier to make the distinction and show the relationship at the same time.
An example would be from the Mouse.java program we looked at in our text.
// This method simulates one day of growth for the mouse.
public void grow()
{
this.weight += (.01 * this.percentGrowthRate * this.weight);
this.age++
} // end grow
Criteria - Write one or two paragraphs. Provide valuable and thoughtful feedback for the above answer with constructive criticism and critiques. Present original thoughts and ideas in postings, (avoid simple agreement or disagreement with, or restatement of other's postings) You may want to provide additional information from your outside readings or other outside resources. I encourage you to share links to other excellent resources during this course.