KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > T15111rs1


1
2 class T15111rs1 {
3     static T15111rs1 a() {
4     System.out.print("a ");
5     return t;
6     }
7     static int i = 0;
8     static T15111rs1 t = new T15111rs1();
9
10     T15111rs1() {}
11     T15111rs1(char c) { System.out.print("c "); }
12     public String JavaDoc toString() {
13     System.out.print("d ");
14     return null;
15     }
16     public static void main(String JavaDoc[] args) {
17     a().i++; // method invocation
18
a().t.i++; // field access
19
(t.a()).i++; // parenthesized expression
20
new T15111rs1('c').i++; // instance creation
21
((T15111rs1)a()).i++; // safe cast
22
("" + t).CASE_INSENSITIVE_ORDER.toString(); // string conversion
23
(t = null).i++; // assignment
24
if (t != null) System.out.print("Oops ");
25     (t == null ? a() : a()).i++; // conditional
26
if (i != 7) System.out.print("Oops ");
27     i = 0;
28     T15111rs1[] ta = {t};
29     ta[i++].i++; // array access
30
if (i != 2) System.out.print("Oops ");
31     }
32 }
33     
34
Popular Tags