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 Data Structures Efficiency! Menu UI

Dylan Carter
Dylan Carter
4,780 Points

how to get a IOException when running the code?

I have the code working as it should up to this point, I was trying to enter stuff that I thought would apply the IOException, numbers, symbols, just spaces, nothing... but all that did was go the default of the switch and start it over again, what exactly would need to happen to make this exception work?

When you use IOException (which is Input / Output Exception) is also used when you open a connection between your program and internet. In that scenario when there is interruption between your device and the internet the IOException will take care of the error gracefully. Now going back to your question, there shouldn't be any input that will call the IOException.

So why use it? To expect the unexpected.

hope that helps