[자바의 정석] Arrays
https://youtu.be/jKP2zX_p57c 1. 배열 채우기 - fill(), setAll() int [ ] arr = new int [5]; Arrays.fill(arr,9); // arr = [9, 9, 9, 9, 9] Arrays.setAll(arr, (i) -> (int)(Math.random()*5)+1); //arr = [2, 4, 5, 1, 1] (1
2023. 5. 21.
[자바의 정석] Array로 배열 다루기
https://youtu.be/N0zXNFPA8G8 1. 배열 비교와 출력 - equals(), toString() int [ ] arr = {0, 1, 2, 3, 4}; int [ ] [ ] arr2D = {{11, 12},{21, 22}}; Sop(Arrays.toString(arr)); // [0, 1, 2, 3, 4] Sop(Arrays.deepToString(arr)); // [11, 12], [21, 22]] String [ ] [ ] str2D = new String [ ] [ ] {{aaa,bbb},{AAA,BBB}}; String [ ] [ ] str2D2 = new String [ ] [ ] {{aaa,bbb},{AAA,BBB}}; Sop(Arrays.equals(str2D, str2D..
2023. 5. 21.