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 trial

Java

this.field VS mField [Java]

From what I have learned, there are two conventions to solving the "variable name confliction" problem. Say the field is called field normally. To solve the confliction problem, one way is to use this.field within the methods. Another way is to rename the field mField. Which convention is better, and why? Please answer! Thanks! ~Alex

1 Answer

As explained in the videos, these are equally 'good', pick whatever you like better. They are only teaching both so that you'll be prepared to end up in a team that uses one or another.