MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / ExtraFeatures

Class ExtraFeatures

exceptions/ExtraFeatures.java:22–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22public class ExtraFeatures {
23 public static void f() throws MyException2 {
24 System.out.println(
25 "Throwing MyException2 from f()");
26 throw new MyException2();
27 }
28 public static void g() throws MyException2 {
29 System.out.println(
30 "Throwing MyException2 from g()");
31 throw new MyException2("Originated in g()");
32 }
33 public static void h() throws MyException2 {
34 System.out.println(
35 "Throwing MyException2 from h()");
36 throw new MyException2("Originated in h()", 47);
37 }
38 public static void main(String[] args) {
39 try {
40 f();
41 } catch(MyException2 e) {
42 e.printStackTrace(System.out);
43 }
44 try {
45 g();
46 } catch(MyException2 e) {
47 e.printStackTrace(System.out);
48 }
49 try {
50 h();
51 } catch(MyException2 e) {
52 e.printStackTrace(System.out);
53 System.out.println("e.val() = " + e.val());
54 }
55 }
56}
57/* Output:
58Throwing MyException2 from f()
59MyException2: Detail Message: 0 null

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected