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 (Retired) Creating the MVP Getting Started

What exactly do we mean by a boilerplate, why was it used it in context of the Hangman.java class. Thanks !!

The term boilerplate was used in context for the Hangman.java class.

1 Answer

Harry James
Harry James
14,780 Points

Hey Ankit!

We use boilerplate as a word to explain code that seems excessive, and constantly repeated, basically it's just generic code we have to write time and time again.

So in the case of the Hangman class, the boilerplate code is the class declaration and the constructor, we always have to type that out for each class time and time again.

Luckily now, boilerplate code isn't much of an issue, as our IDE's (Integrated Development Environments - software designed for the task of writing code) take care of the hard work for us, which you can learn about in the later Local Development Environments course. If you take the Android courses as well, you'll also learn a bit more about boilerplate code, as every time we have to refer to "elements" on the screen, we have to write a long line of code out.


Hopefully this should help but if you have any more questions, feel free to give me a shout :)

Thanks for the quick response, Harry.