-1
I am reading a vector in java and make the sum of all the elements but this saying that 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];
}
}
}
when the error occurs?
– user28595
netbeans itself mimics an alert
– rafael marques
Why not direct sum? Need to store in vector even?
– user28595