In general, I have a cycle of forts, in a cycle of a random boolean generator, true or false, if true, then variable i displays a series of numbers in the interval. So how can you define this same loop in a method so that I can run a lot of its instances somewhere from the code while getting the value of the variable i?
for (int op = 0; op>0; op++) { boolean bo = random.nextBoolean(); if (bo == true) { for ( i = 0; i < 5; i++) { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(i); } } else { try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } } That is, for example, I have several conclusions from System.out.Println (), and each of them must launch a new instance of this method and receive different values of the variable. Not necessarily on Println (), I can drawText () for this purpose. For me, the main thing is to understand this example. Thank!
for (int op = 0; op > 0; op++)loop will execute exactly 0 times. Therefore, it is difficult to call it infinite. - Regent