KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > T15111rs3


1
2 class T15111rs3 {
3     public String JavaDoc toString() { throw new IllegalArgumentException JavaDoc(); }
4     public static void main(String JavaDoc[] args) {
5     try { // string conversion will fail
6
java.util.Comparator JavaDoc c =
7             ("foo" + new T15111rs3()).CASE_INSENSITIVE_ORDER;
8         System.out.print("Oops ");
9     } catch (IllegalArgumentException JavaDoc e) {
10         System.out.print("OK");
11     }
12     }
13 }
14     
15
Popular Tags