inserisci su gli import
import java.util.Scanner;
codice:
public static void main(String[] args) {
Scanner tastiera = new Scanner(System.in);
int[] primo;
int[] secondo;
System.out.println("Inserire lunghezza primo array");
int lunghezzauno = tastiera.nextInt();
System.out.println("Inserire lunghezza secondo array");
int lunghezzadue = tastiera.nextInt();
primo = new int[lunghezzauno];
secondo = new int[lunghezzadue];
for (int i = 0; i < lunghezzauno; i++) {
primo[i] = (int) (Math.random() * lunghezzauno);
}
for (int i = 0; i < lunghezzadue; i++) {
secondo[i] = (int) (Math.random() * lunghezzadue);
}
if (Math.random() * 2 < 0.5) {
System.out.println("Array scelto: primo");
System.out.println("numero scelto " + primo[(int) (Math.random() * lunghezzauno)]);
} else {
System.out.println("Array scelto: secondo");
System.out.println("numero scelto " +secondo[(int) (Math.random() * lunghezzadue)]);
}
}