blob: fb72d45aa5ff34b14e3f127c653fcab9d78211a4 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
package test.input;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Method;
public class TestJavac7 {
public void testTryResources() throws IOException {
try (FileReader reader = new FileReader("file"); FileReader reader1 = new FileReader("file")) {
System.out.println();
}
}
public void testTryResources1() throws IOException {
try (FileReader reader = new FileReader("file")) {
System.out.println("block");
} catch(RuntimeException ex) {
System.out.println(ex.toString());
} finally {
System.out.println("finally");
}
}
public void testMultiCatch() {
try {
Method method = getClass().getDeclaredMethod("foo");
} catch (NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
}
public void testSwitchString() {
String s = "";
switch(s) {
case "Aa": // "xyz":
System.out.println("!");
break;
case "BB": // "abc":
System.out.println("?");
break;
case "__":
System.out.println("_");
break;
default:
System.out.println("#");
}
}
}
|