I'm learning how to program in java and I'm stuck on how to create multiple objects using loops.
class LaunchFarmer {
public static void main(String[] args) {
for(int i=1;i<=3;i++)
{
Farmer f = new Farmer;
f.input();
f.compute();
f.display();
}
}
}
Now, this will create 3 objects to access the above methods, but I also would like to specify each farmer like farmer 1, farmer 2 and so on. How can I do that?