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 Delivering the MVP Exceptions

yige yang
yige yang
8,329 Points

what is letter + "

The code: if (misses.indexOf(letter) != -1 || hits.indexOf(letter) != -1){ throw new IllegalArgumentExceoption(letter + " has already been guessed);

1 Answer

Jason Mendez
Jason Mendez
6,630 Points

The + symbol is not a letter here. It is the symbol for concatenation. This means that the letter variable is combined with the string that follows. For example, if letter holds the value 'A' then the resulting string in the exception message would be "A has already been guessed"