2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libjava / testsuite / libjava.lang / pr179.java
blobec99efc1a79cfcd58ee61dd86581d020cc0e9e19
1 // Extended regression test for the PR 179.
2 //
3 // This tests the ".class" language syntax, initialization behaviour for
4 // Class.isInstance() and Class.isAssignableFrom(), and isAssignableFrom()
5 // functionality in the event that an interface argument that is not
6 // implemented by any loaded class is given.
7 //
8 // Bryce McKinlay <bryce@albatross.co.nz>
10 class A
12 static
14 System.out.println("A initialized");
18 interface IA {}
20 class B implements IA
22 static
24 System.out.println("B initialized");
28 class C
30 static
32 System.out.println("C initialized");
36 interface IB {}
38 public class pr179
40 public static void main(String[] args)
42 System.out.println (A.class.isAssignableFrom (Object.class));
43 System.out.println (IB.class.isAssignableFrom (B.class));
44 System.out.println (IA.class.isAssignableFrom (B.class));
45 A a = new A();
46 System.out.println (C.class.isInstance (a));
47 C c = new C();
48 System.out.println (C.class.isInstance (c));
52 /* Expected Output:
53 A initialized
54 false
55 B initialized
56 false
57 true
58 C initialized
59 false
60 true