What will be the output of the following program? Javaclass CustomException…
What will be the output of the following program?
Javaclass CustomException extends Exception {
public CustomException(String message) {
super(message);
}
}
public class Geeks {
public static void main(String[] args) {
try {
throw new CustomException("Custom error occurred");
} catch (CustomException e) {
System.out.println(e.getMessage());
}
}
}
- A.
Custom error occurred
- B.
Runtime Exception
- C.
Compilation Error
- D.
No Output
Attempted by 255 students.
Sign up free to check your answer
Sign up freeLoading lesson…

