summaryrefslogtreecommitdiffstats
path: root/voronoi/Classtest.java
diff options
context:
space:
mode:
Diffstat (limited to 'voronoi/Classtest.java')
-rw-r--r--voronoi/Classtest.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/voronoi/Classtest.java b/voronoi/Classtest.java
new file mode 100644
index 0000000..9f13fde
--- /dev/null
+++ b/voronoi/Classtest.java
@@ -0,0 +1,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++;
+
+ }
+
+ }
+}