I'm reading a vector in java and making the sum of all elements but this is saying that they are incompatible type, how to solve
My code
package capitulo2;
import java.util.Scanner;
public class Capitulo2 {
public static void main(String[] args) {
Scanner teclado = new Scanner(System.in);
long i, tam,soma=0;
tam = teclado.nextLong();
long [] vetor = new long[10000002];
for (i = 0; i < tam; i++) {
vetor[i] = teclado.nextLong();
soma += vetor[i];
}
}
}