Skip to content

Commit 746fae7

Browse files
committed
Update exception terminology to clarify types of exceptions
1 parent cf00071 commit 746fae7

File tree

3 files changed

+21
-30
lines changed

3 files changed

+21
-30
lines changed

concepts/exceptions/about.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ An exception is an event that occurs during the execution of a program that disr
88
Exceptions are raised explicitly in Java, and the act of raising an exception is called _throwing an exception_.
99
The act of handling an exception is called _catching an exception_.
1010

11-
Java distinguishes three types of exceptions:
11+
Java distinguishes two types of exceptions:
1212

1313
1. Checked exceptions
1414
2. Unchecked exceptions
15-
3. Errors
1615

1716
### Checked exceptions
1817

@@ -21,7 +20,7 @@ An example of a checked exception is the `FileNotFoundException` which occurs wh
2120

2221
This type of exception is checked at compile-time: methods that throw checked exceptions should specify this in their method signature, and code calling a method that might throw a checked exception is required to handle it or the code will not compile.
2322

24-
All exceptions in Java that do not inherit from `RuntimeException` or `Error` are considered checked exceptions.
23+
All exceptions in Java that do not inherit from `RuntimeException` are checked exceptions.
2524

2625
### Unchecked exceptions
2726

@@ -30,17 +29,15 @@ An example of an unchecked exception is the `NullPointerException` which occurs
3029

3130
This type of exception is not checked at compile-time: methods that throw unchecked exceptions are not required to specify this in their method signature, and code calling a method that might throw an unchecked exception is not required to handle it.
3231

33-
All exceptions in Java that inherit from `RuntimeException` are considered unchecked exceptions.
32+
All exceptions in Java that inherit from `RuntimeException` are unchecked exceptions.
3433

35-
### Errors
34+
## Errors
3635

37-
_Errors_ are exceptional conditions that are external to an application.
38-
An example of an error is the `OutOfMemoryError` which occurs when an application is trying to use more memory than is available on the system.
36+
Java also has a separate category called _Errors_ which are serious problems that are external to an application. An example of an error is the `OutOfMemoryError` which occurs when an application is trying to use more memory than is available on the system.
3937

40-
Like unchecked exceptions, errors are not checked at compile-time.
41-
They are not usually thrown from application code.
38+
Like unchecked exceptions, errors are not checked at compile-time and are not usually thrown from application code. Unlike exceptions, Errors represent serious system-level problems that applications should generally not attempt to catch or handle.
4239

43-
All exceptions in Java that inherit from `Error` are considered errors.
40+
All errors in Java inherit from the `Error` class.
4441

4542
## Throwing exceptions
4643

concepts/exceptions/introduction.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ An exception is an event that occurs during the execution of a program that disr
88
Exceptions are raised explicitly in Java, and the act of raising an exception is called _throwing an exception_.
99
The act of handling an exception is called _catching an exception_.
1010

11-
Java distinguishes three types of exceptions:
11+
Java distinguishes two types of exceptions:
1212

1313
1. Checked exceptions
1414
2. Unchecked exceptions
15-
3. Errors
1615

1716
### Checked exceptions
1817

@@ -21,7 +20,7 @@ An example of a checked exception is the `FileNotFoundException` which occurs wh
2120

2221
This type of exception is checked at compile-time: methods that throw checked exceptions should specify this in their method signature, and code calling a method that might throw a checked exception is required to handle it or the code will not compile.
2322

24-
All exceptions in Java that do not inherit from `RuntimeException` or `Error` are considered checked exceptions.
23+
All exceptions in Java that do not inherit from `RuntimeException` are checked exceptions.
2524

2625
### Unchecked exceptions
2726

@@ -30,17 +29,15 @@ An example of an unchecked exception is the `NullPointerException` which occurs
3029

3130
This type of exception is not checked at compile-time: methods that throw unchecked exceptions are not required to specify this in their method signature, and code calling a method that might throw an unchecked exception is not required to handle it.
3231

33-
All exceptions in Java that inherit from `RuntimeException` are considered unchecked exceptions.
32+
All exceptions in Java that inherit from `RuntimeException` are unchecked exceptions.
3433

35-
### Errors
34+
## Errors
3635

37-
_Errors_ are exceptional conditions that are external to an application.
38-
An example of an error is the `OutOfMemoryError` which occurs when an application is trying to use more memory than is available on the system.
36+
Java also has a separate category called _Errors_ which are serious problems that are external to an application. An example of an error is the `OutOfMemoryError` which occurs when an application is trying to use more memory than is available on the system.
3937

40-
Like unchecked exceptions, errors are not checked at compile-time.
41-
They are not usually thrown from application code.
38+
Like unchecked exceptions, errors are not checked at compile-time and are not usually thrown from application code. Unlike exceptions, Errors represent serious system-level problems that applications should generally not attempt to catch or handle.
4239

43-
All exceptions in Java that inherit from `Error` are considered errors.
40+
All errors in Java inherit from the `Error` class.
4441

4542
## Throwing exceptions
4643

exercises/concept/calculator-conundrum/.docs/introduction.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ An exception is an event that occurs during the execution of a program that disr
1010
Exceptions are raised explicitly in Java, and the act of raising an exception is called _throwing an exception_.
1111
The act of handling an exception is called _catching an exception_.
1212

13-
Java distinguishes three types of exceptions:
13+
Java distinguishes two types of exceptions:
1414

1515
1. Checked exceptions
1616
2. Unchecked exceptions
17-
3. Errors
1817

1918
#### Checked exceptions
2019

@@ -23,7 +22,7 @@ An example of a checked exception is the `FileNotFoundException` which occurs wh
2322

2423
This type of exception is checked at compile-time: methods that throw checked exceptions should specify this in their method signature, and code calling a method that might throw a checked exception is required to handle it or the code will not compile.
2524

26-
All exceptions in Java that do not inherit from `RuntimeException` or `Error` are considered checked exceptions.
25+
All exceptions in Java that do not inherit from `RuntimeException` are checked exceptions.
2726

2827
#### Unchecked exceptions
2928

@@ -32,17 +31,15 @@ An example of an unchecked exception is the `NullPointerException` which occurs
3231

3332
This type of exception is not checked at compile-time: methods that throw unchecked exceptions are not required to specify this in their method signature, and code calling a method that might throw an unchecked exception is not required to handle it.
3433

35-
All exceptions in Java that inherit from `RuntimeException` are considered unchecked exceptions.
34+
All exceptions in Java that inherit from `RuntimeException` are unchecked exceptions.
3635

37-
#### Errors
36+
### Errors
3837

39-
_Errors_ are exceptional conditions that are external to an application.
40-
An example of an error is the `OutOfMemoryError` which occurs when an application is trying to use more memory than is available on the system.
38+
Java also has a separate category called _Errors_ which are serious problems that are external to an application. An example of an error is the `OutOfMemoryError` which occurs when an application is trying to use more memory than is available on the system.
4139

42-
Like unchecked exceptions, errors are not checked at compile-time.
43-
They are not usually thrown from application code.
40+
Like unchecked exceptions, errors are not checked at compile-time and are not usually thrown from application code. Unlike exceptions, Errors represent serious system-level problems that applications should generally not attempt to catch or handle.
4441

45-
All exceptions in Java that inherit from `Error` are considered errors.
42+
All errors in Java inherit from the `Error` class.
4643

4744
### Throwing exceptions
4845

0 commit comments

Comments
 (0)