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!
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
I have a doubt that about static with final
Why are we using static with final in MAX_MISSES variable ? Is only final not enough to make MAX_MISSES constant ?
Henrique Voni12,296 Points
Static means that the MAX_MISSES property is a class property. Making it static lets you handle some logic when a object from that class is created.
final indicates that the value of the variable won't change - in other words, a variable who's value can't be modified after it is declared. Use public final static String when you want to create a String that: belongs to the class (static: no instance necessary to use it), and that won't change (final), for instance when you want to define a String constant that will be available to all instances of the class, and to other objects using the class.