I need help, The array in Class Loto generates 6 random numbers and print them out. the Class Lotto askes the user to input 6 numbers which are stored in an array. i need code to compare the two arrays and see if they equal each other, and if they do display how many i got right. PLEASE HELP
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;
public class Loto {
public static void main(String[] arg)
{
ArrayList<Integer> al = new ArrayList<Integer>();
for(int i = 1; i <= 49; i++)
al.add(i);
Random ran = new Random();
for(int i = 0; i < 6; i++)
{
int x = al.remove(ran.nextInt(al.size()));
System.out.print(" " + x);
}
System.out.println();
}
}
import java.util.*;
import java.util.Scanner;
class lotto{
public static void main(String[]args){
int f[] = new int[6];
Scanner keyboard = new Scanner(System.in);
for(int j=0; j<f.length; j++){
System.out.print("Input your " + (f[0]+1) + "st lotto number: ");
f[0] = keyboard.nextInt();
}
}
}