1. 가로 출력되는 값 : print를 이용할 것
2. ( i== (array.length-1) ) ? " " : "," ) i가 마지막 인덱스일때는 ""출력하고 아니면 , 찍어준다
System.out.print("scores: {" );
for(int i=0; i<cloned.scores.length; i++) {
System.out.print(cloned.scores[i]);//값을 하나씩 출력
System.out.print( (i==(cloned.scores.length-1)) ? "":"," );
}
System.out.println("}");
'Java > etc' 카테고리의 다른 글
Swing (0) | 2021.04.01 |
---|---|
Formatting (수정필요) (0) | 2021.03.24 |