diff --git a/src/test/one/A.java b/src/test/one/A.java new file mode 100644 index 0000000..323abbd --- /dev/null +++ b/src/test/one/A.java @@ -0,0 +1,7 @@ +package test.one; + +public class A implements MyMethodInterface { + public void myMethod() { + + } +} diff --git a/src/test/one/B.java b/src/test/one/B.java new file mode 100644 index 0000000..7e049c4 --- /dev/null +++ b/src/test/one/B.java @@ -0,0 +1,7 @@ +package test.one; + +public class B implements MyMethodInterface { + public void myMethod() { + + } +} diff --git a/src/test/one/Main.java b/src/test/one/Main.java new file mode 100644 index 0000000..7e620f8 --- /dev/null +++ b/src/test/one/Main.java @@ -0,0 +1,13 @@ +package test.one; + +public class Main { + public static void main(String[] args) { + Object[] objects = { + new A(), + new B(), + }; + for (Object object : objects) { + ((MyMethodInterface)object).myMethod(); + } + } +} diff --git a/src/test/one/MyMethodInterface.java b/src/test/one/MyMethodInterface.java new file mode 100644 index 0000000..282ee3c --- /dev/null +++ b/src/test/one/MyMethodInterface.java @@ -0,0 +1,5 @@ +package test.one; + +public interface MyMethodInterface { + void myMethod(); +}