// This appears in Core Web Programming from
// Prentice Hall Publishers, and may be freely used
// or adapted. 1997 Marty Hall, hall@apl.jhu.edu.

class One {}

class Two extends One {}

class Three extends Two {}

class Four extends Three {}

public class InstanceOf {
  public static void main(String[] args) {
    Two test1 = new Two();
    Four test2 = new Four();
    report(test1, "test1");
    report(test2, "test2");
  }

  public static void report(Object object, String name) {
    System.out.println(name + " is One: " +
                       (object instanceof One));
    System.out.println(name + " is Two: " +
                       (object instanceof Two));
    System.out.println(name + " is Three: " +
                       (object instanceof Three));
    System.out.println(name + " is Four: " +
                       (object instanceof Four));
  }
}


