Creating a custom exception class
class CustomException implements Exception {
String errorMessage() {
return "no";
}
}
// some code somewhere
throw CustomException;class CustomException implements Exception {
String errorMessage() {
return "no";
}
}
// some code somewhere
throw CustomException;