1 2 3 4 5 6 7 8 9 | public class Test { public static void main(String[] args) { int[]A = {1,2,3,4,5}; for (int i = 0; i < 12; i++) { System.out.println(A[i%A.length]); } } } | cs |
결과
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1 2 3 4 5 1 2 3 4 5 1 2 | cs |
'자바' 카테고리의 다른 글
SOLID (0) | 2019.07.02 |
---|---|
C언어와 자바의 차이점 (0) | 2019.01.15 |
static (0) | 2019.01.14 |
Interface와 Abstract (0) | 2019.01.13 |