java - Making new objects of different classes in a single for loop -
i'm new programming, , stuck. have 5 different classes in project: foo1, foo2, foo3, foo4, , foo5 different, similar things. need create new object of each one, like: foo1 bar1 = new foo1(); foo2 bar2 = new foo2(); foo3 bar3 = new foo3(); , on. sure works, i'm trying find way conserve lot of space if instantiate objects need in single for-loop, or in least put objects want create in single array work out of. can working if same class, not if different. possible?
try read polymorphism can use in java. how interfaces , abstract classes works. extends
, implements
keyword in java , other ...
i found these tutorials looks good:
Comments
Post a Comment