aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs170/language/MultiCatch.java
blob: 8beede752e2ade67fc38811b4452d7741454cd1d (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
public class MultiCatch {

	public static void main(String[] args) {
		try {
			foo("abc");
		} catch (ExceptionA | ExceptionB ex) {
			bar(ex);
		}
	}

	public static void bar(Exception ea) {

	}

	public static void foo(String s) throws ExceptionA, ExceptionB {
		if (s.equals("ta")) {
			throw new ExceptionA();
		} else {
			throw new ExceptionB();
		}
	}
}

@SuppressWarnings("serial")
class ExceptionA extends Exception {
}

@SuppressWarnings("serial")
class ExceptionB extends Exception {
}