blob: f3818050e30c02a1850563f5d69cd60579bb755c (
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
|
import java.io.*;
import java.util.*;
/**
* @version 1.0
* @author
*/
public class DynamicHelloWorld implements Serializable {
public static void main(String[] args) {
try {
new DynamicHelloWorld().doit("hello", Collections.EMPTY_LIST);
} catch (UnsupportedOperationException t) {
System.out.println("expected and caught: " + t);
return;
}
throw new RuntimeException("should have caught exception");
}
String doit(String s, List l) {
l.add(s); // this will throw an exception
return l.toString();
}
}
|