Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

when I run my program it give me this result [[I@4e280c ?!

$
0
0
it's give me same error in these method!!
How can i fix it??

  public static int[] allRowSums(int[][] a) {
        int[] sumRow = new int[a.length];
        for (int row = 0; row < a.length; row++) {
            for (int col = 0; col < a[row].length; col++) {
                sumRow[row] += a[row][col];
            }
        }
        return sumRow;
        
    }

    public static boolean isRowMagic(int[][] a) {
       int[] sums = Assignment3.allRowSums(a);
          boolean magic = false;
        for(int i = 1; i<sums.length; i++) {
            if (sums[i] == sums[i-1]) {
                magic = true;
            }
        }
        return magic;
    }


    public static boolean isColumnMagic(int[][] a) {
        for (int col = 0; col < a[0].length; col++) {
            int sum = 0;
            for (int row = 0; row < a.length; row++) {
                sum = sum + a[row][col];
                if (sum == sum++) {
                    sum++;
                    return true;
                }
            }
        }
        return false;
    }
    public static boolean isMagic(int[][] a) {
        return (isSquare(a) && isColumnMagic(a) && isRowMagic(a));}

    public static void main(String[] args) {


        int[][] arr = {{8, 9}, {2, 17}, {49, 4}, {13, 119}, {11, 47}, {3, 73}};
        int[][] ar = {{8, 9}, {8, 9}, {8, 9}, {8, 9}, {8, 9}, {8, 9}};

       int[] a=allRowSums(arr);

        System.out.println(ar);

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>