package voronoi; class Parent { public Parent() { } } class Child extends Parent { public Child() { super(); } } public class Classtest { public static void main(String[] a) { Parent[] test = new Parent[3]; test[0] = new Parent(); test[1] = new Parent(); test[2] = new Child(); int count = 0; for (Parent parent : test) { System.out.print("Index " + count + " is of type: "); if (parent instanceof Child) { System.out.println("Children"); } if (parent instanceof Parent) { System.out.println("Parent"); } count++; } } }