3
I’ve got this exercise here from college:
Write a java program that takes two size vectors different and then indicates how many equal numbers there are between these two vectors.
I’m not able to develop the logic, for now the code is just reading the arrays:
package vetores2;
import java.util.Scanner;
public class ex02 {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int[] vetor = new int[10];
int[] vetor2= new int[9];
int totalIgual = 0;
System.out.println(" Insira os valores do primeiro vetor");
for(int i = 0; i < vetor.length; i++) {
vetor[i] = entrada.nextInt();
}
System.out.println(" Insira os valores do segundo vetor");
for(int i = 0; i < vetor2.length; i++) {
vetor2[i] = entrada.nextInt();
}
From there I’m not able to continue...
Vector only or you can use
Collection
within the method?– Sorack
Technically, since I’m a beginner I shouldn’t use, but using or not valid. good that I learn with more practicality.
– Yan Luis