Answers for "how to iterate array in java but leave the last element"

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 "how to iterate array in java but leave the last element"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language