Java - Custom Exceptions
What will be the output of the following code?
public class Test {
static void method() throws Exception {
throw new Exception("Error occurred");
}
public static void main(String[] args) {
try {
method();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}