Modify the given method. It should throw a checked exception.
Throwing exceptions
Throw a checked exception
Report a typo
Write a program in Java 17
public class Main {
public static void method() {
// write your code here
}
/* Do not change code below */
public static void main(String[] args) {
try {
method();
} catch (RuntimeException e) {
System.out.println("RuntimeException");
} catch (Exception e) {
System.out.println("Exception");
}
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.