✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
if (i == 0)
throw new NullPointerException ( "first");
...
if (i == 2)
throw new NumberFormatException ( "second");
...
if (i == 4)
throw new ClassCastException ( "third");