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 trialmichael lee
5,179 Pointsillegal argument exception
Can the Illegal argument exception be replaced by system.out.println ?? if possible what is the reason for Illegal argument exception to exist?
1 Answer
<noob />
17,062 PointsHi, as far as i know u need the use of exceptions is to anticipate exceptions in code that may happen and recover from them. for example if u have a program that let only 14 years old people to enter the app u would want to let the user a second chance to enter his age because he miss entered the number etc.. if u use exceptions u can hande this situation and ask the user to try again. exceptions give u more details about the exception that happened.
here is a stackoverflow article : https://stackoverflow.com/questions/24336123/in-java-why-should-we-specify-the-exception-type-in-the-catch-block