OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [instance.java] - Blame information for rev 765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
// instance.java -- test the `instanceof' operator.
2
 
3
import java.util.EventListener;
4
 
5
public class instance implements EventListener
6
{
7
  public static void main (String[] args)
8
  {
9
    Object x1 = new instance ();
10
    EventListener x2 = new instance ();
11
    IllegalArgumentException iae
12
      = new IllegalArgumentException ("any random class");
13
    String x3 = "zardoz";
14
    Object x4 = "zardoz";
15
 
16
    // Test simple object stuff
17
    System.out.println (x1 instanceof Object);
18
    System.out.println (x1 instanceof IllegalArgumentException);
19
    System.out.println (x1 instanceof EventListener);
20
    System.out.println (x1 instanceof String);
21
    System.out.println ("=");
22
 
23
    // Test with value which is an interface.
24
    System.out.println (x2 instanceof Object);
25
    System.out.println (x2 instanceof IllegalArgumentException);
26
    System.out.println (x2 instanceof EventListener);
27
    System.out.println ("=");
28
 
29
    // Test with value which is a final class.
30
    System.out.println (x3 instanceof Object);
31
    System.out.println (x3 instanceof String);
32
    System.out.println ("=");
33
 
34
    // Test with value which is a random class.
35
    System.out.println (iae instanceof Object);
36
    System.out.println (iae instanceof IllegalArgumentException);
37
    System.out.println (iae instanceof EventListener);
38
    System.out.println ("=");
39
 
40
    // Test with value which is a final class, but not known
41
    // statically.
42
    System.out.println (x4 instanceof Object);
43
    System.out.println (x4 instanceof IllegalArgumentException);
44
    System.out.println (x4 instanceof EventListener);
45
    System.out.println (x4 instanceof String);
46
    System.out.println (x4 instanceof int[]);
47
  }
48
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.