Skip to content

Commit 22209de

Browse files
committed
20150106
1 parent d18d85c commit 22209de

30 files changed

Lines changed: 90 additions & 23 deletions

‎src/exceptions/AlwaysFinally.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package exceptions;
2+
13
//: exceptions/AlwaysFinally.java
24
// Finally is always executed.
35
import static net.mindview.util.Print.*;

‎src/exceptions/FinallyWorks.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package exceptions;
2+
13
//: exceptions/FinallyWorks.java
24
// The finally clause is always executed.
35

‎src/exceptions/InputFile.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package exceptions;
2+
13
//: exceptions/InputFile.java
24
// Paying attention to exceptions in constructors.
35
import java.io.*;

‎src/exceptions/LostMessage.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package exceptions;
2+
13
//: exceptions/LostMessage.java
24
// How an exception can be lost.
35

‎src/exceptions/MultipleReturns.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package exceptions;
2+
13
//: exceptions/MultipleReturns.java
24
import static net.mindview.util.Print.*;
35

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
package exceptions;
2+
13
//: exceptions/OnOffException1.java
24
public class OnOffException1 extends Exception {} ///:~
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
package exceptions;
2+
13
//: exceptions/OnOffException2.java
24
public class OnOffException2 extends Exception {} ///:~

‎src/exceptions/OnOffSwitch.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
package exceptions;
2+
13
//: exceptions/OnOffSwitch.java
24
// Why use finally?
35

46
public class OnOffSwitch {
57
private static Switch sw = new Switch();
68
public static void f()
7-
throws OnOffException1,OnOffException2 {}
9+
throws OnOffException1,OnOffException2 {throw new OnOffException1();}
810
public static void main(String[] args) {
911
try {
1012
sw.on();

‎src/exceptions/Switch.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package exceptions;
2+
13
//: exceptions/Switch.java
24
import static net.mindview.util.Print.*;
35

‎src/exceptions/WithFinally.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package exceptions;
2+
13
//: exceptions/WithFinally.java
24
// Finally Guarantees cleanup.
35

0 commit comments

Comments
 (0)