Answers for "re-loop after last item in array java"

0

re-loop after last item in array java

public class Main {
  public static void main(String[] args) {
   String[] items = new String[] {"one", "two", "three", "four"};
	int i = 0;
	while(true){
		System.out.println(items[i % items.length]);
		i++;
	}
  }
}
Posted by: Guest on March-13-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language