logo

Crowdly

Browser

Add to Chrome

package exceptions; import java.io.IOException; public class ExceptionHandli...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

package exceptions;

import java.io.IOException;

public class ExceptionHandling {

    public static void main(String[] args) {

        try {

            testException(-5);

            testException(-10);

        } catch(IOException e) {

           System.out.print(e.getMessage());

        } finally {

            System.out.print("Releasing resources ");

        }

    }

    public static void testException(int n) throws IOException {

        if (n < 0) {

            throw new IOException("Negative Integer " + n + "FAIL");

        } else if (n > 10) {

            throw new IOException("Only supported for index 0 to 10 ");

        }

    }

}

More questions like this

Want instant access to all verified answers on moodle.myefrei.fr?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome