Java

Java ์ž๋ฐ” 2์ฐจ์› ๋ฐฐ์—ด ์ถœ๋ ฅํ•˜๊ธฐ

๋…ธ๋ฃจ๋ฃฝ 2021. 7. 18. 16:44

Java ์ž๋ฐ” 2์ฐจ์› ๋ฐฐ์—ด ์ถœ๋ ฅํ•˜๊ธฐ

์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ํ•˜๋‹ค ๋ณด๋ฉด 2์ฐจ์› ๋ฐฐ์—ด์„ ํ•œ๋ˆˆ์— ๋ณด๊ณ  ์‹ถ์„ ๋•Œ๊ฐ€ ์žˆ๋‹ค.

์ด๋Ÿด ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๋ฉ”์„œ๋“œ!

 

๋งค๋ฒˆ ๋งŒ๋“ค๊ธฐ ๊ท€์ฐฎ์•„์„œ ๋ธ”๋กœ๊ทธ์— ๊ธฐ๋กํ•ด๋‘”๋‹ค.๐Ÿ˜—

    public static void print2d(int[][] result) {
        int m = result.length;
        int n = result[0].length;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                System.out.print(result[i][j] + "\t");
            }
            System.out.println();
        }
        System.out.println("----------------------");
    }