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

Samantha Kelsey
Samantha Kelsey
5,146 Points

program ends in inteliJ

When I run this code in InteliJ, if I guess the same later twice it throws the IllegalArgumentException as you would expect but it also ends the program all together and I cannot make anymore guess. I have followed along with all the videos and I have no errors, I have double and triple checked my code to make sure. Is this because I am running in InteliJ and not in workspaces or is there another reason this would be happening. Thank you for any answers!

2 Answers

hi, can u paste ur code?

Samantha Kelsey
Samantha Kelsey
5,146 Points

Hi I have figured it out, its the "ease" of using intelij and being able to auto add in, I had this: try { isHit = game.applyGuess(guess); isAcceptable = true; } catch (IllegalAccessError iae) { System.out.println(iae.getMessage()+ "Please try again"); } and you can see it says IllegalAccessError not IllegalArgumentException. oups! I both love being able to use the shortcuts but I have learned from them as well.