Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSued Khaleel
350 PointsWhy To assign Value?
Why to assign value X = x and Y = y when we r not using small x and y?I'am confused plz help
1 Answer
Steven Parker
231,198 PointsThe fields are permanent, but the parameters are temporary.
The small x and y are parameters of the constructor. They only exist briefly while the class is being set up. But the capital X and Y are feilds in the class which last as long as the created instance.
So inside the constructor, the passed parameter values are copied into the fields so they will persist as part of that class instance.