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 Java Objects Meet Objects Methods

Why we use get?

Why we use the get for making new method is it a naming convension?

1 Answer

Yes, naming methods getVariable and setVariable when those methods are used to get or set an instance variable is a naming convention. You don't have to name your methods this way, but it helps other developers understand at a glance what the method is for.

Thnks Livia for clearing my doubt.