Skip to content

Commit fbf7c98

Browse files
committed
Chapter 11 done with. Started Chapter 12
1 parent 1dfe6e9 commit fbf7c98

File tree

7 files changed

+107
-1
lines changed

7 files changed

+107
-1
lines changed

Chapter11/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
These exercises need completing.
2+
3+
I do not fully understand the questions either due to poor wording, or lack of
4+
understanding on my part.
5+
6+
This will be returned to at a later date.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Filename: ExceptionA.java
3+
*
4+
* Description: 11.17 - ExceptionA superclass
5+
*
6+
* Created: 02/12/15 01:00:34
7+
* Revision: none
8+
*
9+
* @Author: Siidney Watson - siidney.watson@gmail.com
10+
* @Version: 1.0
11+
*
12+
* =====================================================================================
13+
*/
14+
public class ExceptionA extends Exception{
15+
16+
// constructor
17+
public ExceptionA(String message){
18+
super(message);
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Filename: ExceptionB.java
3+
*
4+
* Description: 11.17 - ExceptionB subclass inherits from ExceptionA
5+
*
6+
* Created: 02/12/15 01:01:01
7+
* Revision: none
8+
*
9+
* @Author: Siidney Watson - siidney.watson@gmail.com
10+
* @Version: 1.0
11+
*
12+
* =====================================================================================
13+
*/
14+
public class ExceptionB extends ExceptionA{
15+
16+
// constructor
17+
public ExceptionB(String message){
18+
super(message);
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Filename: ExceptionC.java
3+
*
4+
* Description: 11.17 - ExceptionC subclass inherits from ExceptionB
5+
*
6+
* Created: 02/12/15 01:05:12
7+
* Revision: none
8+
*
9+
* @Author: Siidney Watson - siidney.watson@gmail.com
10+
* @Version: 1.0
11+
*
12+
* =====================================================================================
13+
*/
14+
public class ExceptionC extends ExceptionB{
15+
16+
// constructor
17+
public ExceptionC(String message){
18+
super(message);
19+
}
20+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Filename: ExceptionTest.java
3+
*
4+
* Description: 11.17 - Test application
5+
*
6+
* Created: 02/12/15 01:15:21
7+
* Revision: none
8+
*
9+
* @Author: Siidney Watson - siidney.watson@gmail.com
10+
* @Version: 1.0
11+
*
12+
* =====================================================================================
13+
*/
14+
public class ExceptionTest{
15+
public static void main(String[] args){
16+
17+
try{
18+
getExceptionB();
19+
}catch(ExceptionA ea){
20+
ea.printStackTrace();
21+
}
22+
23+
try{
24+
getExceptionC();
25+
}catch(Exception ea){
26+
ea.printStackTrace();
27+
}
28+
}
29+
public static void getExceptionB() throws ExceptionB{
30+
throw new ExceptionB("ExceptionB");
31+
}
32+
public static void getExceptionC() throws ExceptionC{
33+
throw new ExceptionC("ExceptionC");
34+
}
35+
}

Chapter11/exercises/CathchingExceptionsWithSuperclasses/instructions

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ ExceptionB
1212
|
1313
V
1414
ExceptionC
15+
16+
NOTE :: Solution copied verbatim from StackOverflow as the question wasn't
17+
formulated clearly enough for my small brain to comprehend.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ solutions may not be done in the most efficient, or even correct, way.
2121
> - **Chapter 8** - Classes and Objects: A Deeper Look
2222
> - **Chapter 9** - Object-Oriented Programming: Inheritence
2323
> - **Chapter 10** - Object-Oriented Programming: Polymorphism
24-
> - **Chapter 11** - Exception Handling: A Deeper Look (in progress)
24+
> - **Chapter 11** - Exception Handling: A Deeper Look (partially complete)
25+
> - **Chapter 12** - ATM Case Study, Part 1: Object-Oriented Design with the UML
26+
> (in progress)

0 commit comments

Comments
 (0)