Hello,
anna_a schrieb:
> I want to create some kind of list, array or similar that contains activities (that are described in separate classes) that are supposed to be executed in a consecutive order.
>
> For example we could have activities/classes "Warming up", "Running", and "Stretching" - what I want is for these to be gathered together somehow, so that I from the main method can extract the first item (warming up) of the container/list/array (or whatever it might be) and then execute that activity by creating the constructor of that class, and after that's been done move forward to the next activity, execute it, and so on. Any tips on how to achieve this would be greatly appreciated!
if you really need the constructor of the classes to be executed, you
can use s.th like:
List<Class> l = new ArrayList<Class>();
l.add(A.class);
l.add(B.class);
for (Class c : l) {
c.newInstance();
}
Regards
franz