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! Design the UI

Sean M
Sean M
7,344 Points

Java: Design the UI

I was wondering if somebody could clarify what the catch (IOException) section.

Thank you.

1 Answer

In your promptAction method you ask for user input and in Java anything IO throws an exception, I believe. In the javadocs it says the readLine method can throw an exception "If an I/O error occurs". For more info on why it may throw an exception look at this stackoverflow post: https://stackoverflow.com/questions/2629649/java-what-are-ioexceptions-in-bufferedreaders-readline-for

Sean M
Sean M
7,344 Points

Forgot to say thanks for this!

It makes sense now.