Extending Exception/RunTimeException in java?

前端 未结 5 1948
失恋的感觉
失恋的感觉 2020-12-04 11:15

I have below classes.

public class ValidationException extends RuntimeException {


}

and

public class ValidationException          


        
5条回答
  •  北荒
    北荒 (楼主)
    2020-12-04 12:06

    If you are in an application framework and your framework is good to handle the exception when there is an exception notification from your code. In that case you can use your custom exception class as subclass of RuntimeException.

    This will help you from NOT to write the code to handle the exception through out the exception hierarchy.

提交回复
热议问题