File tree Expand file tree Collapse file tree
core-java-modules/core-java/src/main/java/com/baeldung/exceptions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ static class AgeCalculator {
3030 private AgeCalculator () {
3131 }
3232
33- public static int calculateAge (String birthDate ) throws CalculationException {
33+ public static int calculateAge (String birthDate ) {
3434 if (birthDate == null || birthDate .isEmpty ()) {
3535 throw new IllegalArgumentException ();
3636 }
@@ -44,7 +44,7 @@ public static int calculateAge(String birthDate) throws CalculationException {
4444 }
4545 }
4646
47- private static LocalDate parseDate (String birthDateAsString ) throws DateParseException {
47+ private static LocalDate parseDate (String birthDateAsString ) {
4848
4949 LocalDate birthDate ;
5050 try {
@@ -62,14 +62,14 @@ private static LocalDate parseDate(String birthDateAsString) throws DateParseExc
6262
6363 }
6464
65- static class CalculationException extends Exception {
65+ static class CalculationException extends RuntimeException {
6666
6767 CalculationException (DateParseException ex ) {
6868 super (ex );
6969 }
7070 }
7171
72- static class DateParseException extends Exception {
72+ static class DateParseException extends RuntimeException {
7373
7474 DateParseException (String input ) {
7575 super (input );
You can’t perform that action at this time.
0 commit comments