I need to have three arrays. The first array will allow the user to enter the points scored by a basketball team of 10 players for game 1. The second array will allow the user to enter the points scored for game 2. The third array will add the first two arrays together.
I'm stuck on the first part. I don't understand how to get the user to enter a number. I tried an input, but I got an error. How do I make it so the user can enter a number?
import java.util.Scanner;
public class array2 {
public static void main(String[] args) {
int i;
int [] game1 = new int[10];
// Enter Points scored by players in game 1
// Enter points scored by players in game 2
// Add arrays together
Scanner scanLine = new Scanner(System.in);
Scanner scanInt = new Scanner(System.in);
for (i=0;i<game1.length;i++)
{
System.out.println ("The score of game 1 is " + game1[i]);
}
}
}