summaryrefslogtreecommitdiffstats
path: root/voronoi/Classtest.java
blob: 9f13fdeb7942c25d166fe61007eb9d463fd2cff4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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++;

		}

	}
}