title: error: bad operand types for binary operator '+'
body: <p>Im getting error in the following code which says "error: bad operand types for binary operator '+'. The error appears at the line <code>sum+=arr[i]</code>
      This Code is to calculate diagonal difference of an integer matrix</p>
  
  <pre><code>import java.io.*;
  import java.util.*;
  import java.text.*;
  import java.math.*;
  import java.util.regex.*;
  
  public class Solution {
  
      public static void main(String[] args) {
          Scanner in = new Scanner(System.in);
          int n = in.nextInt();
          int a[][] = new int[n][n];
          for(int a_i=0; a_i &lt; n; a_i++){
              for(int a_j=0; a_j &lt; n; a_j++){
                  a[a_i][a_j] = in.nextInt();
              }
          }
          Solution solution= new Solution();
          solution.diagonalDifference(a,n);
      }
      public void diagonalDifference(int arr[][],int n){
          int sum=0,sum1=0,sum2=0;
          for(int i=0; i &lt; n;i++){
              for(int j=0; j &lt; n;j++){
                  if(i==j){
                      sum1+=arr[i];//calculating sum of primary diagonal
                  }
              }
          }
          for(int i=0; i &lt; n;i++){
              for(int j=n; j &gt;0;j--){
                   sum2+=arr[i];//calculating sum of secondary diagonal
              }
          }
          sum=Math.abs(sum1-sum2);
          System.out.println(sum);
      }
  }
  </code></pre>
  
  <p>Error:-</p>
  
  <pre><code>Solution.java:26: error: bad operand types for binary operator '+'
                      sum+=arr[i];//calculating sum of primary diagonal
                         ^
    first type:  int
    second type: int[]
  Solution.java:32: error: bad operand types for binary operator '+'
                   sum+=arr[i];//calculating sum of secondary diagonal
                      ^
    first type:  int
    second type: int[]
  2 errors
  </code></pre>