Skip to lesson

Must-do problems: Exception Basics

Real programs get bad input all the time. These problems ask you to print a clear message for every bad line and keep going, never crash. Start with the easy ones, and check each program against every test before moving on.

What you will learn

What you will learn

  • Catch the right exception for bad numbers, zero divisors and wrong indexes
  • Use multiple catch blocks in the right order, and finally
  • Throw IllegalArgumentException with a clear message from your own methods
  • Validate every input line and keep the program running

Sign in to continue this lesson

Create an account to read every lesson, practise with the exercises and keep track of your progress.