aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/test1/TryCatch.java
blob: 72f21073027522561e4149636fb3c75712d6aa56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package test1;

public class TryCatch {
    int a = 0;
    String s = null;

    public void init() {
	s = "test";
    }

    public void doit() {
	a = s.length();
    }

    public void m2() {}

    public int m1() {
	m2();
	return a;
    }

    public int p1() {
	try {
	    return s.length();
	}
	catch (NullPointerException e) {
	    throw e;
	}
    }

    public int run() {
	return m1();
    }
}