Array of Interface in Java
yes, it is possible. You need to fill the fields of the array with objects of Type Module
instances[0] = new MyModule();
And MyModule
is a class implementing the Module interface. Alternatively you could use anonymous inner classes:
instances[0] = new Module() { public void actions() {} public void init() {}};
Does this answer your question?